#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define iter set< pair<char,pair<int,int>> >::iterator
#define all(a) a.begin(),a.end()
#define endl '\n'

using namespace std;

const int N = 3e5 + 3;

string s[N];
string t;
vector< pair<int,int> >pos[26];

main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    for (int i=1;i<=n;++i){
        cin>>s[i];
        pos[s[i][0]-'a'].pb({i,0});
    }
    string ans="";
    cin>>t;
    for (int k=0;k<t.size();++k){
        int ch = t[k]-'a';
        while(true){
            int best_j=-1;
            for (int j=0;j<26;++j){
                if (j==ch)continue;
                if (pos[j].size()>0 && (best_j==-1 || pos[j].size()>pos[best_j].size())){
                    best_j=j;
                }
            }
            if (best_j!=-1){
                ans+=best_j+'a';
                vector<pair<int,int>>next_best_j;
                for (int k=0;k<pos[best_j].size();++k){
                    int ind_s = pos[best_j][k].ff;
                    int ind = pos[best_j][k].ss;
                    if (s[ind_s].size()>ind+1){
                        int new_ch = s[ind_s][ind+1]-'a';
                        if (new_ch==best_j){
                            next_best_j.pb({ind_s,ind+1});
                        } else {
                            pos[new_ch].pb({ind_s,ind+1});
                        }
                    }
                }
                pos[best_j]=next_best_j;
            } else {
                if (pos[ch].size()==0){
                    cout<<"YES"<<endl;
                    cout<<ans<<endl;
                    exit(0);
                } else {
                    best_j=ch;
                    ans+=best_j+'a';
                    if (k==t.size()-1){
                        cout<<"NO"<<endl;
                        exit(0);
                    }
                    vector<pair<int,int>>next_best_j;
                    for (int k=0;k<pos[best_j].size();++k){
                        int ind_s = pos[best_j][k].ff;
                        int ind = pos[best_j][k].ss;
                        if (s[ind_s].size()>ind+1){
                            int new_ch = s[ind_s][ind+1]-'a';
                            if (new_ch==best_j){
                                next_best_j.pb({ind_s,ind+1});
                            } else {
                                pos[new_ch].pb({ind_s,ind+1});
                            }
                        }
                    }
                    pos[best_j]=next_best_j;
                    break;
                }
            }
        }
    }
    cout<<"NO"<<endl;
}