#include "bits/stdc++.h"
using namespace std;

// #define int long long
#define ld long double
#define ll long long
#define st first
#define nd second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(x) begin(x),end(x)
#define FOR(i,l,r) for(int i = (l); i <= (r); i++)
#define ROF(i,r,l) for (int i = (r); i >= (l); i--)

auto& operator<<(auto&o, pair<auto,auto>p) {
	return o << "("  << p.st << ", " << p.nd << ")";
}
auto operator<<(auto&o, auto x)->decltype(end(x), o) {
	o << "{"; int i =0; for (auto e : x) o << ","+!i++ << e; 
	return o << "}";
}
#ifdef LOCAL
#define debug(x...) cerr << "[" #x "]: ", [](auto...$) { \
	((cerr << $ << "; "), ...) << endl; }(x)
#else
#define debug() {}
#endif

#define rep(i, a, b) for (int i = (a); i < (b); i++)
using pii = pair<int, int>;
using vi = vector<int>;

const int inf = 1e9 + 7;

int n;
int trie[300000][27];
string t;
string ans;
vi st;

int match;
void dfs(int u) {
	// debug(u, ans, match);

	for (char c = 'a'; c <= 'z'; c++) if (trie[u][c - 'a']) {
		if (c != t[match]) {
			ans += c;
			dfs(trie[u][c - 'a']);
		}
	}

	char ch = t[match] - 'a';
	if (trie[u][ch]) {
		st.pb(trie[u][ch]);
	}
}

signed main() {
	cin.tie(0)->sync_with_stdio(0);

	cin >> n;

	int nxt = 1;
	rep(i, 0, n) {
		string s;
		cin >> s;

		int u = 0;
		for (char c : s) {
			if (trie[u][c - 'a'] == 0) {
				trie[u][c - 'a'] = nxt++;
			}

			u = trie[u][c - 'a'];
		}
	}

	cin >> t;

	st.pb(0);
	rep(i, 0, sz(t)) {
		match = i;

		vi xd = st;
		st.clear();
		for (int j : xd) {
			dfs(j);
		}

		if (st.empty()) {
			break;
		}

		ans += t[match];
	}

	if (st.size()) {
		cout << "NO\n";
		return 0;
	}
	
	cout << "YES\n";
	cout << ans << '\n';

	return 0;
}