#include <bits/stdc++.h> using namespace std; const int MAXN = 200010; string s[MAXN], t, sol; int idx[MAXN]; set<int> S; int main() { ios::sync_with_stdio(false); cin.tie(); int n; cin >> n; for (int i = 0; i < n; i++) { cin >> s[i]; idx[i] = 0; S.insert(i); } cin >> t; for (auto c : t) { vector<int> izb; for (auto el : S) { while (idx[el] != s[el].size() && s[el][idx[el]] != c) { sol += s[el][idx[el]]; idx[el]++; } if (idx[el] == s[el].size()) { izb.push_back(el); } } for (auto el : izb) { S.erase(el); } if (S.size() == 0) { cout << "YES\n" << sol; return 0; } sol += c; for (auto el : S) { if (idx[el] != s[el].size() && s[el][idx[el]] == c) { idx[el]++; } } } cout << "NO"; return 0; } /* 2 porto euc prague */