#include <bits/stdc++.h> using namespace std; using ll = int64_t; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<string> ss(n); vector<int> ind(n); int done = 0; string t; for(int i = 0; i < n; ++i) { cin >> ss[i]; } cin >> t; int ti = 0; string res; while(done < n) { if(ti == t.size()) { cout << "NO\n"; return 0; } if(done == n) break; char c = t[ti]; for(int i = 0; i < n; ++i) { if(ind[i] == ss[i].size()) continue; while(ind[i] < ss[i].size() && ss[i][ind[i]] != c) { res += ss[i][ind[i]]; ++ind[i]; } if(ind[i] == ss[i].size()) ++done; } if(done == n) break; ++ti; res += c; for(int i = 0; i < n; ++i) { if(ind[i] == ss[i].size()) continue; if(ind[i] < ss[i].size() && ss[i][ind[i]] == c) { ++ind[i]; } if(ind[i] == ss[i].size()) ++done; } } cout << "YES\n"; cout << res << '\n'; return 0; }