#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>

int main() {
	int n;
	std::cin >> n;

	std::vector<std::string> s(n);
	for (auto &x : s) {
		std::cin >> x;
		std::reverse(x.begin(), x.end());
	}

	std::string t;
	std::cin >> t;

	std::string out;
	size_t i = 0;
	for (; i < t.size() && s.size() > 0; ) {
		auto c = t[i];
		bool take = false;
		for (auto &x : s) {
			while (x.size() > 0 && x.back() != c) {
				out += x.back();
				x.pop_back();
			}
			if (x.size() > 0) {
				x.pop_back();
				take = true;
			}
		}

		size_t k = 0;
		for (size_t j = 0; j < s.size(); ++j) {
			if (s[j].size() > 0) {
				auto tmp = std::move(s[j]);
				s[k++] = std::move(tmp);
			}
		}
		s.erase(s.begin() + k, s.end());

		if (take) {
			out += c;
			++i;
		}
	}

	if (i == t.size()) {
		std::cout << "NO\n";
	} else {
		std::cout << "YES\n";
		std::cout << out << '\n';
	}
}