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

#define all(x) ::begin(x), ::end(x)
#define tsolve int t; cin >> t; while (t--) solve
#define sz(x) (int)::size(x)
using ll = long long;
using ld = long double;

void solve() {
    int n;
    cin >> n;
    vector<string> a(n);
    for (string& e : a) cin >> e;
    string t;
    cin >> t;

    string ans;
    vector<int> ptr(n);
    vector<vector<int>> idk(26);
    for (int i=0; i<n; i++) {
        idk[a[i][0]-'a'].push_back(i);
    }

    for (int ind=0; ind<ssize(t); ind++) {
        char c = t[ind];
        bool change = false;
        for (int i=0; i<26; i++) {
            if (i != c-'a' && !idk[i].empty()) {
                ans += 'a' + i;
                int j = idk[i].back();
                idk[i].pop_back();
                ptr[j]++;
                if (ptr[j] < ssize(a[j])) {
                    idk[a[j][ptr[j]] - 'a'].push_back(j);
                }
                change = true;
            }
        }
        if (change) {
            ind--;
            continue;
        }
        if (ind+1 == ssize(t)) break;
        ans += c;
        auto idk2 = idk[c-'a'];
        idk[c-'a'].clear();
        for (int e : idk2) {
            ptr[e]++;
            if (ptr[e] < ssize(a[e])) {
                idk[a[e][ptr[e]]-'a'].push_back(e);
            }
        }
    }

    for (int i=0; i<26; i++) if (!idk[i].empty()) {
        cout << "NO\n";
        return;
    }
    cout << "YES\n" << ans << '\n';
}

int main() {
    cout.tie(0)->sync_with_stdio(false);
    cout << setprecision(16);
    solve();
}