#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fi first #define se second #define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); const int N = (int)2e5 + 10; const int AL = 26; int pi[N]; set<int> M[AL]; string s[N]; int main(){ fastIO; int n; cin >> n; for(int i = 1; i <= n; i ++ ){ cin >> s[i]; M[s[i][0] - 'a'].insert(i); } string t; cin >> t; string res; int m = t.size(); for(int i = 0 ; i < m ; i ++ ){ for(int j = 0 ; j < AL; j ++ ){ if(t[i] - 'a' != j){ auto it = M[j].begin(); vector<int> re; while(it != M[j].end()){ int x = *it; re.push_back(x); it = M[j].erase(it); while(pi[x] < s[x].size() && s[x][pi[x]] != t[i]){ res.push_back(s[x][pi[x]]); pi[x] ++ ; } } for(auto x : re){ if(pi[x] < s[x].size()){ M[s[x][pi[x]] - 'a'].insert(x); } } } } int v = t[i] - 'a'; if(!M[v].empty()){ res.push_back(char('a' + v)); vector<int> re; auto it = M[v].begin(); while(it != M[v].end()){ int x = *it; re.push_back(x); it = M[v].erase(it); pi[x] ++ ; } for(auto x : re){ if(pi[x] < s[x].size()){ M[s[x][pi[x]] - 'a'].insert(x); } } } } for(int i = 0 ; i < n; i ++ ){ if(pi[i] < s[i].size()){ cout << "NO\n"; return 0; } } int w = 0; for(int i = 0 ; i < res.size(); i ++ ){ if(w < t.size() && res[i] == t[w]){ w ++ ; } } if(w == t.size()){ cout << "NO\n"; return 0; } cout << "YES\n" << res << "\n"; return 0; }