#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    int n;
    std::cin >> n;
    auto words = std::vector<std::pair<std::string, int>>(n, {{}, 0});
    for (auto &w : words) std::cin >> w.first;

    auto s = std::string{};
    std::cin >> s;
    auto cur = 0;

    auto res = std::string{};

    while (!words.empty() && cur < s.size()) {
        auto t = s[cur];
        std::erase_if(words, [&](auto &p) {
            auto &[w, i] = p;
            while (i < w.size() && w[i] != t)
                res.push_back(w[i++]);

            return i == w.size();
        });

        if (words.empty()) break;

        res.push_back(t);
        cur += 1;

        std::erase_if(words, [&](auto &p) {
            auto &[w, i] = p;
            if (i < w.size() && w[i] == t)
                i++;

            return i == w.size();
        });
    }

    if (cur == s.size()) {
        std::cout << "NO\n";
    } else {
        std::cout << "YES\n";
        std::cout << res << '\n';
    }
}