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

void greedy(vector<int> num, vector<string> &s) {
    cout << "Yes\n";
    for (auto &S : s) {
        int a = S[0] - 'A', b = S[1] - 'A';
        if (num[a] > num[b]) {
            cout << S[1] << '\n';
            --num[a];
            ++num[b];
        } else {
            cout << S[0] << '\n';
            --num[b];
            ++num[a];
        }
    }
    return;
}

int encode(vector<int> &num) {
    return num[0] * 9 + num[1] * 3 + num[2];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, A, B, C;
    cin >> N >> A >> B >> C;
    vector<string> s(N);
    for (int i = 0; i < N; ++i) {
        cin >> s[i];
    }
    vector<int> num = {A, B, C};
    if (A > 0 && B > 0 && C > 0) {
        greedy(num, s);
        return 0;
    }
    else {
        if (*max_element(num.begin(), num.end()) >= 3) {
            int a = s[0][0] - 'A', b = s[0][1] - 'A';
            if (num[a] == 0 && num[b] == 0) {
                cout << "No\n";
                return 0;
            }
            greedy(num, s);
            return 0;
        }
        // DP
        vector<vector<bool>> DP(N + 1, vector<bool>(27, false)); // (0 ~ 2) ^ 3
        DP[0][encode(num)] = true;
        for (int i = 0; i < N; ++i) {
            // DP[i] -> DP[i + 1]
            int a = s[i][0] - 'A', b = s[i][1] - 'A';
            for (int j = 0; j < 27; ++j) {
                if (DP[i][j]) {
                    vector<int> cur = {j / 9, (j / 3) % 3, j % 3};
                    if (cur[a] >= 1) {
                        --cur[a];
                        ++cur[b];
                        DP[i + 1][encode(cur)] = true;
                        ++cur[a];
                        --cur[b];
                    }
                    if (cur[b] >= 1) {
                        --cur[b];
                        ++cur[a];
                        DP[i + 1][encode(cur)] = true;
                        ++cur[b];
                        --cur[a];
                    }
                }
            }
        }
        int index = -1;
        for (int j = 0; j < 27; ++j) {
            if (DP[N][j]) {
                index = j;
            }
        }
        if (index == -1) {
            cout << "No\n";
            return 0;
        }
        vector<char> ans(N);
        for (int i = N - 1; i >= 0; --i) {
            // DP[i + 1] -> DP[i]
            vector<int> cur = {index / 9, (index / 3) % 3, index % 3};
            int a = s[i][0] - 'A', b = s[i][1] - 'A';
            bool first = false;
            if (cur[a] >= 1) {
                --cur[a];
                ++cur[b];
                if (DP[i][encode(cur)]) {
                    first = true;
                    index = encode(cur);
                    ans[i] = s[i][0];
                }
                ++cur[a];
                --cur[b];
            }
            if (!first) {
                --cur[b];
                ++cur[a];
                index = encode(cur);
                ans[i] = s[i][1];
            }
        }
        cout << "Yes\n";
        for (int i = 0; i < N; ++i) {
            cout << ans[i] << '\n';
        }
    }
    return 0;
}

Measured memory_bytes: 13700