#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

#define For(i,a , n)for(ll i = a;i<(ll)n;i++)
#define vec vector
#define all(x) begin(x), end(x)
#define sz(x)(ll)size(x)

template<class A, class B>
pair<A, B> operator+(const pair<A, B>& a, const pair<A, B>& b){
    return {a.first + b.first, a.second + b.second};
}

template<class A, class B>
ostream& operator<<(ostream& os, const pair<A, B>& a){
    return os<<"("<<a.first<<", "<<a.second<<")";
}

template<class A, class B, class C>
basic_ostream<A, B>& operator<<(basic_ostream<A, B>& os, const C& c){
    for(auto itr = begin(c);itr!=end(c);++itr){
        os<<(itr==begin(c)?"":" ")<<*itr;
    }
    return os;
}

template<typename... Args>
void dbg(Args&&... args){
    ((cerr<<args<<"| "),...);
    cerr<<endl;
}

void solve(){

    ll n;
    cin >> n;
    vector<string> good(n);
    For(i,0,n){
        cin >> good[i];
    }
    string bad;
    cin >> bad;

    ll badpos = 0;
    vector<ll> positions(n,0);
    vector<vector<ll>> which_begin(26);

    For(i,0,n){
        which_begin[good[i][0]-'a'].push_back(i);
    }

    string answer = "";

    while(true){
        ll to_do = -1;
        For(i,0,26){
            if('a'+i == bad[badpos]){
                continue;
            }
            if(which_begin[i].size() > 0){
                to_do = i;
                break;
            }
        }
        if(to_do == -1){
            if(which_begin[bad[badpos]-'a'].size() == 0){
                cout << "YES\n";
                cout << answer << "\n";
                return;
            }
            if(badpos == bad.length()-1){
                cout << "NO\n";
                return;
            }
            to_do = bad[badpos]-'a';
            badpos++;
        }
        answer.push_back('a'+to_do);
        vector<vector<ll>> updates(26);
        For(i,0,which_begin[to_do].size()){
            ll word_i = which_begin[to_do][i];
            positions[word_i]++;
            if(positions[word_i] == good[word_i].length()){
                //nic
            }else{
                updates[good[word_i][positions[word_i]]-'a'].push_back(word_i);
            }
        }
        which_begin[to_do].clear();
        For(i,0,26){
            For(j,0,updates[i].size()){
                which_begin[i].push_back(updates[i][j]);
            }
        }
    }
    
}

int main(){
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);
    ll t = 1; // cin>>t;
    while(t--)solve();
}