#include <bits/stdc++.h> using namespace std; int n; string s[200005]; string t; int sz[200005], pos_s[200005]; int szt, pos_t; string ans; queue<int> waiting; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 0; i < n; i++) { cin >> s[i]; sz[i] = s[i].size(); } cin >> t; szt = t.size(); for (int i = 0; i < n; i++) { while (pos_s[i] < sz[i] && s[i][pos_s[i]] != t[0]) { ans += s[i][pos_s[i]]; pos_s[i]++; } if (pos_s[i] < sz[i]) waiting.push(i); } while (!waiting.empty()) { if (pos_t == szt - 1) { cout << "NO\n"; return 0; } ans += t[pos_t]; pos_t++; int cnt = waiting.size(); for (int j = 0; j < cnt; j++) { int i = waiting.front(); waiting.pop(); pos_s[i]++; while (pos_s[i] < sz[i] && s[i][pos_s[i]] != t[pos_t]) { ans += s[i][pos_s[i]]; pos_s[i]++; } if (pos_s[i] < sz[i]) waiting.push(i); } } cout << "YES\n" << ans << '\n'; }