#include <bits/stdc++.h> using namespace std; #define pb push_back const int N=200050; string s[N]; int ptr[N]; vector<int> cand[26]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin>>n; for(int i=1;i<=n;i++){ cin>>s[i]; } string t; cin>>t; for(int i=1;i<=n;i++){ cand[s[i][0]-'a'].pb(i); } string ans=""; int now=0; while(now<t.size()){ int work=-1; for(int i=0;i<26;i++){ if(t[now]-'a'!=i && cand[i].size()>0){ work=i; } } if(work==-1 && cand[t[now]-'a'].size()>0){ work=t[now]-'a'; } if(work==-1){ break; } vector<int> arr=cand[work]; //cout << cand[work].size() << "\n"; cand[work].clear(); for(int i:arr){ ptr[i]++; if(ptr[i]<s[i].size()){ cand[s[i][ptr[i]]-'a'].pb(i); } } ans+=('a'+work); if(work==t[now]-'a')now++; //cout<<ans<<"\n"; } if(now==t.size())cout<<"NO\n"; else{ cout << "YES\n"; cout << ans << "\n"; } return 0; }