#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define len(x) (int)(x.size())
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;

bool umin(int& a, int b) {
    if(b < a) {
        a = b;
        return true;
    }
    return false;
}

bool umax(int& a, int b) {
    if(b > a) {
        a = b;
        return true;
    }
    return false;
}

//#ifdef KoRoVa
//#define DEBUG for (bool __DEBUG=1;__DEBUG;__DEBUG=0)
//#define LOG(...) prnt(#__VA_ARGS__" ::",_VA_ARGS)<<endl
//#else
//#define DEBUG while(false)
//#define LOG(...) if(false)
//#endif

template <class ...Ts> auto &prnt(Ts ...ts) {
    return ((cerr << ts << " "), ...);
}

const int max_n = -1, inf = 1000111222;

const ll linf = 1000111222000111222;

void test_case() {
    int n;
    cin >> n;
    vector<string> s(n);
    set<pair<char, pii> > av;
    for(int i = 0; i < n; i++) {
        cin >> s[i];
        av.insert({s[i][0], mp(i, 0)});
    }
    string t;
    cin >> t;
    string ans;
    for(int i = 0; i < len(t); i++) {
        bool had_something = true;
        while(had_something) {
            had_something = false;
            while(!av.empty() && (*av.begin()).fi != t[i]) {
                auto cr = (*av.begin()); av.erase(cr);
                ans += cr.fi;
                had_something = true;
                if(cr.se.se + 1 < len(s[cr.se.fi])) {
                    av.insert({s[cr.se.fi][cr.se.se + 1], {cr.se.fi, cr.se.se + 1}});
                }
            }
            while(!av.empty() && (*(--av.end())).fi != t[i]) {
                auto cr = (*(--av.end())); av.erase(cr);
                ans += cr.fi;
                had_something = true;
                if(cr.se.se + 1 < len(s[cr.se.fi])) {
                    av.insert({s[cr.se.fi][cr.se.se + 1], {cr.se.fi, cr.se.se + 1}});
                }
            }
        }
        if(av.empty()) {
            cout << "YES\n" << ans << '\n';
            return;
        }
        if(i == len(t) - 1) break;
        while(!av.empty() && av.lower_bound({t[i], {-1, -1}}) != av.end()) {
            auto cr = (*av.lower_bound({t[i], {-1, -1}}));
            if(cr.fi != t[i]) break;
            av.erase(cr);
            ans += cr.fi;
            if(cr.se.se + 1 < len(s[cr.se.fi])) {
                av.insert({s[cr.se.fi][cr.se.se + 1], {cr.se.fi, cr.se.se + 1}});
            }
        }
        if(av.empty()) {
            cout << "YES\n" << ans << '\n';
            return;
        }
    }
    cout << "NO\n";
}

signed main() {

//    freopen("input.txt", "r", stdin);

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr);

    int testcases = 1;

//    cin >> testcases;

    while(testcases--) test_case();

    exit(0);
}