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

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n; cin >> n;
    vector<string> s(n);
    vector<int> id(n);

    for(int i=0; i<n; i++) cin >> s[i];

    string t; cin >> t;

    vector<vector<int>> chars(26);

    for(int i=0; i<n; i++){
        chars[s[i][0] - 'a'].push_back(i);
    }

    string ans;
    int ok = 0;

    for(int i=0; i<t.length(); i++){
        int c = t[i]-'a';
        bool found = 1;
        while(found){
            found = 0;
            for(int j=0; j<26; j++){
                if(j == c) continue;
                while(chars[j].size()){
                    int v = chars[j].back();
                    chars[j].pop_back();
                    ans += s[v][id[v]];
                    
                    id[v]++;
                    if(id[v] < s[v].size()){
                        found = 1;
                        chars[s[v][id[v]] - 'a'].push_back(v);
                    }
                    else ok++;
                }
            }
        }

        // cout << ans << " " << ok << endl;

        if(ok == n){
            cout << "YES\n";
            cout << ans << endl;
            return 0;
        }


        int j = c;
        ans += j + 'a';
        vector<int> upd;
        while(chars[j].size()){
            int v = chars[j].back();
            chars[j].pop_back();

            upd.push_back(v);
        }

        for(int v: upd){
            
            id[v]++;
            if(id[v] < s[v].size()){
                chars[s[v][id[v]] - 'a'].push_back(v);
            }
            else ok++;
        }
    }

    cout << "NO" << endl;
}