#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define rep(i,a,b) for(auto i = (a); i < (b); ++i)
#define REP(i,n) rep(i,0,n)
#define sz(v) ((int) (v).size())
#define rs resize
#define all(v) begin(v), end(v)

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout << fixed << setprecision(20);
    ll n;
    cin >> n;
    vector<string> s = vector<string>(n);
    for(ll i = 0; i < n; i++)
        cin >> s[i];
    string t;
    cin >> t;
    ll nut = 0;
    string antw = "";
    vi nus = vi(n,0);
    vvi welk = vvi(26);
    for(ll i = 0; i < n; i++)
        welk[s[i][0] - 'a'].pb(i);
    vi plek = vi(n,0);
    while(nut < t.size()){
        ll ander = -1;
        for(ll i = 0; i < 26; i++)
            if(welk[i].size() > 0 && t[nut] - 'a' != i)
            {
                ander = i;
                break;
            }
        if(ander != -1){
            antw.pb('a' + ander);
            ll nu = welk[ander][welk[ander].size()-1];
            welk[ander].pop_back();
            plek[nu]++;
            if(plek[nu] < s[nu].size())
                welk[s[nu][plek[nu]] - 'a'].pb(nu);
            continue;
        }

        //Ga nu iedereen aanpassen
        ander = t[nut] - 'a';
        if(welk[ander].size() == 0)
            break;
        nut++;
        antw.pb('a' + ander);
        vi weg = welk[ander];
        welk[ander].clear();
        for(ll i = 0; i < weg.size(); i++){
            ll nu = weg[i];
            plek[nu]++;
            if(plek[nu] < s[nu].size())
                welk[s[nu][plek[nu]] - 'a'].pb(nu);
        }
    }
    if(nut == t.size()){
        cout << "NO" <<endl;
    }
    else{
        cout << "YES" << endl << antw << endl;
    }
    return 0;
}