#include <bits/stdc++.h> using namespace std; //#define int long long typedef long long ll; typedef long double ld; void solve() { int n; cin >> n; vector<string> lst(n); for (int i =0 ; i < n; i++) { cin >> lst[i]; } string t; cin >> t; vector<string> res(t.size()); int last = 0; bool inc = false; for (int i =0; i < n; i++) { // cerr << 0; int pos = 0; for (int j =0; j < lst[i].size(); j++) { if (lst[i][j] == t[pos]) { pos++; last = max(last, pos); inc = true; if (pos == t.size()) { cout << "NO"; return; } } else { res[pos] += lst[i][j]; } // cerr << 1; } } cout << "YES\n"; for (int i =0; i <= last; i++) { cout << res[i]; if (i != n - 1) cout << t[i]; } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifdef LC freopen("/home/team11/CLionProjects/contest/input.txt", "r", stdin); freopen("/home/team11/CLionProjects/contest/output.txt", "w", stdout); #endif int t= 1 ; //cin >> t; for (int tt =0; tt <t; tt++) { solve(); } return 0; }