#include <bits/stdc++.h>
using namespace std;

vector<int> si[256];
vector<string> s;

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin>>n;
    
    for(int i=0; i<n; ++i) {
        string a;
        cin>>a;
        reverse(a.begin(),a.end());
        s.push_back(a);
        si[a.back()].push_back(i);
    }
    string o;
    cin>>o;
    string ans;
    int ns=n;
    for(int i=0; i<o.size(); ++i) {
        vector<int> ss;
        for(int j='a'; j<='z'; ++j) if(j!=o[i]) {
            for(auto &x:si[j]) {
                ss.push_back(x);
            }
            si[j].clear();
        }
        for(auto &x: ss) {
            while(s[x].size() && s[x].back()!=o[i]) {
                ans.push_back(s[x].back());
                s[x].pop_back();
            }
            if(s[x].size()==0) --ns;
            else si[o[i]].push_back(x);
        }
        if(ns==0) {
            cout<<"YES\n";
            cout<<ans<<'\n';
            return 0;
        }
        //cerr<<ans<<' '<<ns<<endl;
        ans.push_back(o[i]);
        ss.clear();
        for(auto &x: si[o[i]]) {
            s[x].pop_back();
            if(s[x].size()) ss.push_back(x);
            else --ns;
        }
        si[o[i]].clear();
        for(auto &x: ss) {
            si[s[x].back()].push_back(x);
        }
    }
    cout<<"NO\n";
}