#include <bits/stdc++.h>

using namespace std;

int main(){
    cin.tie(0)->sync_with_stdio(0);
    int n; cin>>n;
    string ans = "";
    vector<string> str(n);
    for(int i = 0; i < n; i++) cin >> str[i];
    string t; cin >> t;
    int len_t = t.length();
    int ptr_t = 0;
    vector<int> ptr(n);
    set<int> todo;
    for(int i = 0; i < n; i++) todo.insert(i);
    int completed = 0;
    for(; ptr_t < len_t; ptr_t++){
        char cur = t[ptr_t];
        vector<int> to_rem;
        for(int str_idx:todo){
            while(ptr[str_idx] < str[str_idx].length() && str[str_idx][ptr[str_idx]] != cur){
                ans += str[str_idx][ptr[str_idx]];
                ptr[str_idx]++;
            }
            if(ptr[str_idx] == str[str_idx].length()){
                completed++;
                to_rem.push_back(str_idx);
            }
        }
        for(int x:to_rem) todo.erase(x);
        to_rem.clear();
        if(completed == n) break;
        ans += cur;
        if(ptr_t + 1 == len_t){
            cout << "NO" << endl;
            return 0;
        }
        for(int str_idx:todo){
            if(ptr[str_idx] == str[str_idx].length()){
                continue;
            }
            ptr[str_idx]++;
            if(ptr[str_idx] == str[str_idx].length()){
                completed++;
                to_rem.push_back(str_idx);
            }
        }
        for(int x:to_rem) todo.erase(x);
        if(completed == n) break;
    }
    if(ptr_t == len_t){
        cout << "NO" << endl;
    }
    else{
        cout << "YES" << endl;
        cout << ans << endl;
    }
}