#include <bits/stdc++.h>
#define int long long
#define ll long long
#define sz(x) (int)(x).size()
#define all(x) begin(x),end(x)
#define rep(i,a,b) for (int i=(a);i<(b);i++)
using namespace std;

string to_string (string s) {return s; }
template <typename T> string to_string(T v) {
    bool first = true;
    string res = "[";
    for (const auto & x : v) {
        if (!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "]";
    return res;
}

void dbg_out() { cout << endl;} 
template <typename Head, typename... Tail> void dbg_out(Head H, Tail... T) {
    cout << ' ' << to_string(H);
    dbg_out(T...);
}

#ifdef DEBUG
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

priority_queue <pair <char, int>> To_add;

vector <string> Words;
vector <int> Cnt;
string mascot;

vector <int> InWord[30];

vector <int> Ans;

int nbWords;

void solve() {
    cin >> nbWords;
    Words.resize(nbWords);
    Cnt.resize(nbWords, 0);
    for (string &a : Words)
        cin >> a;
    cin >> mascot;

    for (int i = 0; i < nbWords; i ++)
    {
        InWord[Words[i][0] - 'a'].push_back(i);
    }

    int cur = 0;
    while (true)
    {
        int x = mascot[cur] - 'a';
        int found = 0;
        for (int i = 0; i < 26 && !found; i ++)
        {
            if (i != x && InWord[i].size() > 0)
            {
                vector <int> nv = InWord[i];
                InWord[i].clear();
                Ans.push_back(i);
                for (int old : nv)
                {
                    if (++ Cnt[old] < (int)Words[old].size())
                        InWord[Words[old][Cnt[old]] - 'a'].push_back(old);
                }
                found = 1;
            }
        }
        if (!found)
        {
            if (InWord[x].size() == 0)
                break;
            vector <int> nv = InWord[x];
            InWord[x].clear();
            Ans.push_back(x);
            for (int old : nv)
            {
                if (++ Cnt[old] < (int)Words[old].size())
                    InWord[Words[old][Cnt[old]] - 'a'].push_back(old);
            }
            found = 1;
            if (++ cur == (int)mascot.size())
            {
                printf("NO\n");
                return;
            }
        }
    }
    printf("YES\n");
    for (int a : Ans)
        printf("%c", 'a' + a);
    printf("\n");
    return;
}

signed main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}