#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


string numToChar(int num){
    if(num == 0) return "A";
    else if(num == 1) return "B";
    else return "C";
}

int main()
{
    int N;
    vector<int> num(3);
    cin >> N >> num[0] >> num[1] >> num[2];
    vector<string> s(N);
    REP(i, N) cin >> s[i];

    vector<char> ans;
    long long S = accumulate(num.begin(), num.end(), (long long) 0);
    if(S == 0){
        cout << "No" << endl;
        return 0;
    }
    REP(i, N){
        int c1 = s[i][0] - 'A';
        int c2 = s[i][1] - 'A';
        int c3 = 3-c1-c2;
        if(S == 1){
            if(num[c1]+num[c2] == 0){
                cout << "No" << endl;
                return 0;
            }else{
                int small = (num[c1] > num[c2])? c2: c1;
                int large = (num[c1] > num[c2])? c1: c2;
                ans.push_back(small);
                ++num[small];
                --num[large];
            }
        }else{
            if(c1 == 0){
                ans.push_back(s[i][0]);
                ++num[c1];
                --num[c2];
                continue;
            }
            if(c2 == 0){
                ans.push_back(s[i][1]);
                --num[c1];
                ++num[c2];
                continue;
            }
            if(i+1 < N and c1 == 1 and c3 == 0 and s[i+1] == numToChar(c1)+numToChar(c3)){
                ans.push_back(s[i][0]);
                ++num[c1];
                --num[c2];
                continue;
            }
            if(i+1 < N and c2 == 1 and c3 == 0 and s[i+1] == numToChar(c2)+numToChar(c3)){
                ans.push_back(s[i][1]);
                --num[c1];
                ++num[c2];
                continue;
            }
            cout << s[i][0] << endl;
            ++num[c1];
            --num[c2];
        }
    }
    for(auto c: ans) cout << c << endl;

    return 0;
}