#include <bits/stdc++.h>

#define ll long long
#define all(x) x.begin(), x.end()
#define ve vector
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back


using namespace std;

template <class T>
istream& operator >>(istream&in, vector<T>&v) {
    for(T&el : v) {
        in >> el;
    }
    return in;
}

template <class T>
ostream& operator <<(ostream&out, vector<T>&v) {
    out <<"{";
    for(T&el : v) {
        out << el << ' ';
    }
    out <<"}";
    return out;
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    ve<string> ar(n);
    cin >> ar;
    int tot = 0;
    for (auto& i : ar) reverse(all(i)), tot += i.size();
    vvi symbts(26);
    for (int i = 0; i < n; ++i) {
        symbts[ar[i].back() - 'a'].pb(i);
    }
    string t;
    cin >> t;
    string res;
    int cur = 0;
    while (tot != 0) {
        if (cur == t.size()) return cout << "NO\n", 0;
        char ne = t[cur];
        bool found = false;
        for (int c = 0; c < 26; ++c) {
            if (ne != 'a'+c && !symbts[c].empty()) {
                res += 'a'+c;
                vi nsc;
                for (int x : symbts[c]) {
                    ar[x].pop_back();
                    --tot;
                    if (!ar[x].empty()) {
                        if (ar[x].back() == 'a'+c) nsc.pb(x);
                        else symbts[ar[x].back() - 'a'].pb(x);
                    }
                }
                symbts[c] = nsc;
                found = true;
                break;
            }
        }
        if (!found) {
            ++cur;
            res += ne;
            vi nsc;
            for (int x : symbts[ne - 'a']) {
                ar[x].pop_back();
                --tot;
                if (!ar[x].empty()) {
                    if (ar[x].back() == ne) nsc.pb(x);
                    else symbts[ar[x].back() - 'a'].pb(x);
                }
            }
            symbts[ne - 'a'] = nsc;
        }
    }
    cout << "YES\n" << res << "\n";
}