#include <bits/stdc++.h> using namespace std; using ll = long long; #define int ll using pii = pair<int, int>; void solve() { int n; cin >> n; vector<string>s(n + 1); for(int i = 0;i < n;i++) { cin >> s[i]; } cin >> s[n]; vector<int>nxt(n + 1); vector<set<int>>vc(26); for(int i = 0;i < n + 1;i++) { vc[s[i][0] - 'a'].insert(i); } string ans; while(true) { int good = -1; int not_zero = -1; for(int i = 0;i < 26;i++) { if(vc[i].size()) { not_zero = i; if(vc[i].find(n) == vc[i].end()) { good = i; } } } if(not_zero == -1 or (good == -1 and vc[not_zero] == set<int>{n})) { break; } if(good == -1) { good = not_zero; } ans += ('a' + good); set<int> nxt_good; for(int i : vc[good]) { nxt[i]++; if(nxt[i] < s[i].size()) { if(s[i][nxt[i]] - 'a' == good) { nxt_good.insert(i); } else { vc[s[i][nxt[i]] - 'a'].insert(i); } } } vc[good] = nxt_good; } if(nxt[n] == s[n].size()) { cout << "NO"; return; } cout << "YES" << endl << ans; // for(int i : nxt) { // cerr << i <<" "; // } } int32_t main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); int tt = 1; // cin >> tt; for (int t = 0; t < tt; t++) { solve(); cout << endl; } return 0; }