#include <bits/stdc++.h>

#define X first
#define Y second
#define PB push_back
#define x first
#define y second
#define pb push_back

using namespace std;

typedef long long ll;
typedef vector<int> vi;

const int N=300010,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;

int n, ptr[N];
string s[N], t;
vector<int> v[26], tmp[26];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> s[i];
		v[s[i][0] - 'a'].push_back(i);
	}
	cin >> t;
	int idx = 0;
	string ans = "";
	
	while (idx < (int)t.length()) {
		for (int i = 0; i < 26; ++i) {
			if (i != t[idx] - 'a') {
				while (!v[i].empty()) {
					int j = v[i].back();
					while (ptr[j] < (int)s[j].length() && s[j][ptr[j]] != t[idx]) {
						ans += s[j][ptr[j]++];
					}
					if (ptr[j] < (int)s[j].length()) v[t[idx] - 'a'].push_back(j);
					v[i].pop_back();
				}
			}
		}
		if (!v[t[idx] - 'a'].empty()) {
			ans += t[idx];
			for (int j : v[t[idx] - 'a']) {
				ptr[j]++;
				if (ptr[j] < (int)s[j].length()) {
					tmp[s[j][ptr[j]] - 'a'].push_back(j);
				}
			}
			for (int i = 0; i < 26; ++i) v[i].clear();
			for (int i = 0; i < 26; ++i) swap(v[i], tmp[i]);
			++idx;
		}
		
		bool found = 0;
		for (int i = 0; i < 26; ++i) {
			if (!v[i].empty()) found = 1;
		}
		if (!found) break;
	}
	
	if (idx == (int)t.length()) cout << "NO\n";
	else cout << "YES\n" << ans << "\n";
	
	
	return 0;
}