#include <bits/stdc++.h>

using namespace std;

#define MAX 210000

string s[MAX], t, ans;

int n, idx[MAX], id;

queue<char> x;

queue<int> ch[300], ch1[300];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    cin >> n;

    for(int i = 0; i < n; i++)
    {
        cin >> s[i];
        ch[s[i][0]].push(i);
        x.push(s[i][0]);
    }
    cin >> t;


    bool fl = true, fl2 = true;
    while(fl)
    {
        fl = false;
        fl2 = false;
        while(!x.empty())
        {
            //cout << "  xcx " << x.front() << endl;
            char w = x.front();
            x.pop();
            if(w == t[id])
            {
                continue;
            }
            if(ch[w].size()) ans += w;
            while(!ch[w].empty())
            {
                int j = ch[w].front();
                ch[w].pop();
                idx[j]++;
                if(idx[j] < s[j].size())
                {
                    if(s[j][idx[j]] != w)ch[s[j][idx[j]]].push(j);
                    else ch1[s[j][idx[j]]].push(j);
                    x.push(s[j][idx[j]]);
                    fl = true;
                }
            }
            ch[w] = ch1[w];
            ch1[w] = queue<int>();
            
            ///cout << w << endl;
            
            fl2 = true;
        }
        if(fl2 == false && ch[t[id]].size() > 0)
        {
            char w = t[id++];
                //cout << id << "  " << t.size() << endl;
            if(id == t.size())
            {
                cout << "NO" << endl;
                return 0;
            }

            while(!ch[w].empty())
            {
                int j = ch[w].front();
                ch[w].pop();
                idx[j]++;
                if(idx[j] < s[j].size())
                {
                    if(s[j][idx[j]] != w)ch[s[j][idx[j]]].push(j);
                    else ch1[s[j][idx[j]]].push(j);
                    x.push(s[j][idx[j]]);
                    fl = true;
                }
                
            }
            ch[w] = ch1[w];
            ch1[w] = queue<int>();
            ans += w;
        }
    }

    cout << "YES" << endl;
    cout << ans << endl;

    return 0;
}