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

typedef vector<int> vi;
typedef vector<string> vs;

#define int int64_t

#define loop(i,s,t) for(int i=s;i<t;i++)
#define all(a) a.begin(),a.end()

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;


int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    vs s(n); loop(i,0,n) cin >> s[i];
    vi ind(n);
    string t; cin >> t;
    string mask;
    bool all = true;
    loop(it,0,t.size()){
        char c = t[it];
        bool is = false;
        loop(i,0,n){
            while(ind[i] < s[i].size() && s[i][ind[i]] != c){
                mask.push_back(s[i][ind[i]]);
                ind[i]++;
            }
            if(ind[i] < s[i].size()) is = true;
        }
        if (is){
            mask.push_back(c);
            loop(i,0,n){
                if(ind[i] < s[i].size() && s[i][ind[i]] == c){
                    ind[i]++;
                }
            }
        }
        else
            all = false;
    }
    if (all){
        cout << "NO" << endl;
    }
    else{
        cout << "YES" << endl;
        cout << mask;
    }


    return 0;
}