#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<ll, ll>; using vi = vector<ll>; using vvi = vector<vi>; #define rep(i, a, b) for(ll i = a; i < (b); ++i) #define all(x) begin(x),end(x) #define sz(x) (int)(x).size() int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); cout << setprecision(9) << fixed; ll n; cin >> n; vector<string> s(n); string t; for (auto& x : s) cin >> x, reverse(all(x)); cin >> t; string ans; vi remaining; rep(i,0,n) remaining.push_back(i); rep(nx,0,ssize(t)) { vi nxrem; for (ll i : remaining) { while (!empty(s[i]) && s[i].back() != t[nx]) { ans.push_back(s[i].back()); s[i].pop_back(); } if (!empty(s[i])) nxrem.push_back(i); } if (nx + 1 != ssize(t)) { for (auto x : nxrem) s[x].pop_back(); ans.push_back(t[nx]); } remaining = nxrem; } for (auto x : remaining) if (!empty(s[x])) return cout << "NO\n", 0; cout << "YES\n" << ans; return 0; }