#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int n;
string s, ans;
vector<string> v(3e5);
vector<int> p(3e5, 0);

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> v[i];
        v[i].push_back('#');
    }
    cin >> s;
    for (char c: s) {
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            while (true) {
                if (v[i][p[i]] == '#') break;
                if (v[i][p[i]] == c) {
                    p[i]++;
                    cnt++;
                    break;
                }
                ans.push_back(v[i][p[i]]);
                p[i]++;
            }
        }
        if (!cnt) {
            cout << "YES\n" << ans;
            return 0;
        }
        ans.push_back(c);
    }
    //cout << ans << "\n";
    cout << "NO\n";
}