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

int main() {
    cin.tie(0)->sync_with_stdio(0);
    int n;
    cin >> n;
    vector<string> ss(n);
    for (auto &x: ss) cin >> x;
    vector<int> ptrs(n, 0);
    vector<int> next[26];
    for(int i=0;i<n;++i)
        next[ss[i][0] - 'a'].push_back(i);

    string t;
    cin >> t;
    int total = 0;
    int ts = (int) t.size();
    int ti = 0;
    string ans;
    for (; total < n && ti < ts; ) {
        int c;
        if (ti < ts) {
            c = t[ti] - 'a';
        }
        else c = -1;
        int selected = -1;
        for (int j = 0; j < 26; j++) 
        {
            if (c != j && !next[j].empty()) {
                selected = j;
                break;
            }
        }
        if (selected == -1) {
            selected = c;
        }
        ans += (selected + 'a');
        vector<int> sel = next[selected];
        next[selected].clear();
        for (int ssidx: sel) {
            ptrs[ssidx]++;
            if (ptrs[ssidx] != int(ss[ssidx].size())) {
                next[ss[ssidx][ptrs[ssidx]] - 'a'].push_back(ssidx);
            }
            else {
                total++;
            }
        }

        if (selected == c) ti++;
    }
    if (ti == ts) {
        cout << "NO\n";
    }
    else {
        cout << "YES\n";
        cout << ans << '\n';
    }
    return 0;
}