#include <bits/stdc++.h>

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<string> s(n);
    vector<int> interest(n);
    int interest_size = n;
    for(int i = 0 ; i < n ; i ++){
        cin>>s[i];
        interest[i] = i;
    }
    string bad;
    cin>>bad;
    vector<int> interest_pos(n);
    vector<char> rez;
    bool good = false;
    for(int i = 0 ; i < bad.length() ; i ++){
        bool printed = false;
        for(int j = 0 ; j < interest_size ; j ++){
            int k = interest_pos[j];
            int si = interest[j];
            int silen = s[si].length();
            while(k<silen && s[si][k] != bad[i]){
                rez.push_back(s[si][k]);
                k++;
            }
            if(k<silen){
                interest_pos[j] = k+1;
                printed = true;
            }else{
                swap(interest_pos[j], interest_pos[interest_size-1]);
                swap(interest[j], interest[interest_size-1]);
                interest_size--;
                j--;
            }
        }
        if(printed){
            rez.push_back(bad[i]);
        }else{
            good = true;
            break;
        }
    }
    if(good){
        cout <<"YES"<<endl;
        for(char i : rez){
            cout << i;
        }
    }else{
        cout <<"NO";
    }
}