#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
//long long int countt[200003];
#include<ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set, multimap, map etc.
#include<ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds; //necessary for the GNU based Policy based data structures.
typedef tree<pair<int,int> ,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define int long long
#define endl "\n"


signed main()
{
    FAST;
    
    int i=0,j=0,k=0,n=0,m=0,count=0,temp=0;
    int temp1=0,temp2=0,temp3=0,x=0,l=0,y=0,sum=0;
    int left=0,up=0,down=0,start=0,end=0,r=0,q=0,total=0;
    int maxx=0,minn=0,curr=0,ans=0,places=0,zeroes=0,low=0,high=0;
    int prev=0,mid=0,z=0,d=0,val=0,pos=0,shift=0,h=0,right=0,var=0;
    
    int a,b,c;
    cin>>n>>a>>b>>c;
    string s[n];
    vector<int> tempab,tempbc,tempac;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        
        if(s[i]=="AB")
        {
            tempab.push_back(i);
        }
        
        else if(s[i]=="AC")
        {
            tempac.push_back(i);
        }
        
        else
        {
            tempbc.push_back(i);
        }
    }
    
    vector<char> anss;
    
    for(i=0;i<n;i++)
    {
        if(s[i]=="AB")
        {
            if(a>b)
            {
                a--;
                b++;
                anss.push_back('B');
            }
            
            else if(a<b)
            {
                b--;
                a++;
                anss.push_back('A');
            }
            
            else
            {
                if(a==0||b==0)
                {
                    if(a==0 && b!=0)
                    {
                        b--;
                        a++;
                        anss.push_back('A');
                    }
                    
                    else if(a!=0 && b==0)
                    {
                        a--;
                        b++;
                        anss.push_back('B');
                    }
                    
                    else
                    {
                        cout<<"No"<<endl;
                        return 0;
                    }
                }
                
                else
                {
                    auto it = upper_bound(tempac.begin() , tempac.end() , i) - tempac.begin();
                    auto it1 = upper_bound(tempbc.begin() , tempbc.end() , i) - tempbc.begin();
                    auto it2 = upper_bound(tempab.begin() , tempab.end() , i) - tempab.begin();
                    if(it==tempac.size()) it=1e10;
                    else it=tempac[it];
                    if(it1==tempbc.size()) it1=1e10;
                    else it1=tempbc[it1];
                    if(it2==tempab.size()) it2=1e10;
                    else it2=tempab[it2];
                    if(it>it1)
                    {
                        a--;
                        b++;
                        anss.push_back('B');
                    }
                    
                    else
                    {
                        a++;
                        b--;
                        anss.push_back('A');
                        
                    }
                    
                }
            }
        }
        
        else if(s[i]=="BC")
        {
            if(b>c)
            {
                b--;
                c++;
                anss.push_back('C');
            }
            
            else if(b<c)
            {
                c--;
                b++;
                anss.push_back('B');
            }
            
            else
            {
                //cout<<"yes"<<endl;
                if(c==0||b==0)
                {
                    if(c==0 && b!=0)
                    {
                        b--;
                        c++;
                        anss.push_back('C');
                    }
                    
                    else if(c!=0 && b==0)
                    {
                        c--;
                        b++;
                        anss.push_back('B');
                    }
                    
                    else
                    {
                        cout<<"No"<<endl;
                        return 0;
                        
                    }
                }
                
                else
                {
                    auto it = upper_bound(tempac.begin() , tempac.end() , i) - tempac.begin();
                    auto it1 = upper_bound(tempbc.begin() , tempbc.end() , i) - tempbc.begin();
                    auto it2 = upper_bound(tempab.begin() , tempab.end() , i) - tempab.begin();
                    if(it==tempac.size()) it=1e10;
                    else it=tempac[it];
                    if(it1==tempbc.size()) it1=1e10;
                    else it1=tempbc[it1];
                    if(it2==tempab.size()) it2=1e10;
                    else it2=tempab[it2];
                    
                    if(it>it2)
                    {
                        c--;
                        b++;
                        anss.push_back('B');
                    }
                    
                    else
                    {
                        c++;
                        b--;
                        anss.push_back('C');
                        
                    }
                }
                
            }
            
        }
        
        else
        {
            if(a>c)
            {
                a--;
                c++;
                anss.push_back('C');
            }
            
            else if(a<c)
            {
                c--;
                a++;
                anss.push_back('A');
            }
            
            else
            {
                if(a==0||c==0)
                {
                    if(a==0 && c!=0)
                    {
                        c--;
                        a++;
                        anss.push_back('A');
                    }
                    
                    else if(a!=0 && c==0)
                    {
                        a--;
                        c++;
                        anss.push_back('C');
                    }
                    
                    else
                    {
                        cout<<"No"<<endl;
                        return 0;
                        
                    }
                }
                
                else
                {
                    auto it = upper_bound(tempac.begin() , tempac.end() , i) - tempac.begin();
                    auto it1 = upper_bound(tempbc.begin() , tempbc.end() , i) - tempbc.begin();
                    auto it2 = upper_bound(tempab.begin() , tempab.end() , i) - tempab.begin();
                    if(it==tempac.size()) it=1e10;
                    else it=tempac[it];
                    if(it1==tempbc.size()) it1=1e10;
                    else it1=tempbc[it1];
                    if(it2==tempab.size()) it2=1e10;
                    else it2=tempab[it2];
                    if(it2>it1)
                    {
                        a--;
                        c++;
                        anss.push_back('C');
                    }
                    
                    else
                    {
                        a++;
                        c--;
                        anss.push_back('A');
                        
                    }
                    
                }
                
            }
            
        }
        
        
        
        
    }
    
   
    cout<<"Yes"<<endl;
    for(i=0;i<anss.size();i++)
    {
        cout<<anss[i]<<endl;
    }
    
    
    
    
}

Measured memory_bytes: 7776