Buggy python submission (verdict: Runtime Error):
n,a,b,c=map(int,input().split())
s=list(input() for i in range(n))
ans=["Yes"]

if a+b+c==0:
  del ans[:]
  ans+=["No"]
  
if a+b+c==1:
  for j in range(n):
    
    if s[j]=="AB":
      if c==1:
        del ans[:]
        ans+=["No"]
        break        
      if a==1:
        a-=1
        b+=1
        ans+="B"
      if b==1:
        a+=1
        b-=1
        ans+="A"

    if s[j]=="AC":
      if b==1:
        del ans[:]
        ans+=["No"]
        break       
      if a==1:
        a-=1
        c+=1
        ans+="C"
      if c==1:
        a+=1
        c-=1
        ans+="A" 

    if s[j]=="BC":
      if a==1:
        del ans[:]
        ans+=["No"]
        break
      if b==1:
        b-=1
        c+=1
        ans+="C"
      if c==1:
        b+=1
        c-=1
        ans+="B"  

if a+b+c==2:
  for j in range(n):
    
    if s[j]=="AB":
      if a==2:
        a-=1
        b+=1
        ans+="B"
      if b==2:
        a+=1
        b-=1
        ans+="A" 
      if c==2:
        del ans[:]
        ans+=["No"]
        break     
      if a==1 and b==1:
        if s[j+1]=="AB" or "AC":
          a+=1
          b-=1
          ans+="A"
        if s[j+1]=="BC":
          a-=1
          b+=1
          ans+="B"
      if a==1 and c==1:
        a-=1
        b+=1
        ans+="B"
      if b==1 and c==1:
        a+=1
        b-=1
        ans+="A"
    
    if s[j]=="AC":
      if a==2:
        a-=1
        c+=1
        ans+="C"
      if c==2:
        a+=1
        c-=1
        ans+="A" 
      if b==2:
        del ans[:]
        ans+="No"
        break     
      if a==1 and c==1:
        if s[j+1]=="AB" or "AC":
          a+=1
          c-=1
          ans+="A"
        if s[j+1]=="BC":
          a-=1
          c+=1
          ans+="C"
      if a==1 and b==1:
        a-=1
        c+=1
        ans+="C"
      if b==1 and c==1:
        a+=1
        c-=1
        ans+="A"

    if s[j]=="BC":
      if c==2:
        c-=1
        b+=1
        ans+="B"
      if b==2:
        c+=1
        b-=1
        ans+="C" 
      if a==2:
        del ans[:]
        ans+="No"
        break     
      if c==1 and b==1:
        if s[j+1]=="AB" or "BC":
          b+=1
          c-=1
          ans+="B"
        if s[j+1]=="AC":
          b-=1
          c+=1
          ans+="C"
      if a==1 and c==1:
        c-=1
        b+=1
        ans+="B"
      if b==1 and a==1:
        c+=1
        b-=1
        ans+="C"        
  print(*ans,sep="\n")

if a+b+c>=3:
  if s[0]=="AB" and a+b==0 or s[0]=="AC" and a+c==0 or s[0]=="BC" and b+c==0:
    del ans[:]
    ans+=["No"]
  
  else:
    for j in range(n):
      if s[j]=="AB":
        if a>b:
          a-=1
          b+=1
          ans+="B"
        elif a<=b:
          a+=1
          b-=1
          ans+="A"
        
      if s[j]=="AC":
        if a>c:
          a-=1
          c+=1
          ans+="C"
        elif a<=c:
          a+=1
          c-=1
          ans+="A"     

      if s[j]=="BC":
        if b>c:
          b-=1
          c+=1
          ans+="C"
        elif b<=c:
          b+=1
          c-=1
          ans+="B"
for an in ans:
  print(an)

Fixed submission:
n,a,b,c=map(int,input().split())
s=list(input() for i in range(n))+["XX"]
ans=["Yes"]

if a+b+c==0:
  del ans[:]
  ans+=["No"]
  
if a+b+c==1:
  for j in range(n):
    
    if s[j]=="AB":
      if c==1:
        del ans[:]
        ans+=["No"]
        break        
      elif a==1:
        a-=1
        b+=1
        ans+=["B"]
      elif b==1:
        a+=1
        b-=1
        ans+=["A"]

    if s[j]=="AC":
      if b==1:
        del ans[:]
        ans+=["No"]
        break       
      elif a==1:
        a-=1
        c+=1
        ans+=["C"]
      elif c==1:
        a+=1
        c-=1
        ans+=["A"] 

    if s[j]=="BC":
      if a==1:
        del ans[:]
        ans+=["No"]
        break
      elif b==1:
        b-=1
        c+=1
        ans+="C"
      elif c==1:
        b+=1
        c-=1
        ans+=["B"]  

if a+b+c==2:
  for j in range(n):
    if s[j]=="AB":
      if a==2:
        a-=1
        b+=1
        ans+=["B"]
      elif b==2:
        a+=1
        b-=1
        ans+=["A"]
      elif c==2:
        del ans[:]
        ans+=["No"]
        break     
      elif (a==1 and b==1) and (s[j+1]=="AB" or s[j+1]=="AC" or s[j+1]=="XX"):
        a+=1
        b-=1
        ans+=["A"]
      elif (a==1 and b==1) and (s[j+1]=="BC"):
        a-=1
        b+=1
        ans+=["B"]
      elif a==1 and c==1:
        a-=1
        b+=1
        ans+=["B"]
      elif b==1 and c==1:
        a+=1
        b-=1
        ans+=["A"]
    
    if s[j]=="AC":
      if a==2:
        a-=1
        c+=1
        ans+=["C"]
      elif c==2:
        a+=1
        c-=1
        ans+=["A"] 
      elif b==2:
        del ans[:]
        ans+=["No"]
        break     
      elif (a==1 and c==1) and (s[j+1]=="AB" or s[j+1]=="AC" or s[j+1]=="XX"):
        a+=1
        c-=1
        ans+=["A"]
      elif (a==1 and c==1) and (s[j+1]=="BC"):
        a-=1
        c+=1
        ans+=["C"]
      elif a==1 and b==1:
        a-=1
        c+=1
        ans+=["C"]
      elif b==1 and c==1:
        a+=1
        c-=1
        ans+=["A"]

    if s[j]=="BC":
      if c==2:
        c-=1
        b+=1
        ans+=["B"]
      elif b==2:
        c+=1
        b-=1
        ans+=["C"] 
      elif a==2:
        del ans[:]
        ans+=["No"]
        break     
      elif (c==1 and b==1) and (s[j+1]=="AB" or s[j+1]=="BC" or s[j+1]=="XX"):
        b+=1
        c-=1
        ans+=["B"]
      elif (c==1 and b==1) and (s[j+1]=="AC"):
        b-=1
        c+=1
        ans+=["C"]
      elif a==1 and c==1:
        c-=1
        b+=1
        ans+=["B"]
      elif b==1 and a==1:
        c+=1
        b-=1
        ans+=["C"]        

if a+b+c>=3:
  if s[0]=="AB" and a+b==0 or s[0]=="AC" and a+c==0 or s[0]=="BC" and b+c==0:
    del ans[:]
    ans+=["No"]
  
  else:
    for j in range(n):
      if s[j]=="AB":
        if a>b:
          a-=1
          b+=1
          ans+=["B"]
        elif a<=b:
          a+=1
          b-=1
          ans+=["A"]
        
      if s[j]=="AC":
        if a>c:
          a-=1
          c+=1
          ans+=["C"]
        elif a<=c:
          a+=1
          c-=1
          ans+=["A"]     

      if s[j]=="BC":
        if b>c:
          b-=1
          c+=1
          ans+=["C"]
        elif b<=c:
          b+=1
          c-=1
          ans+=["B"]

for an in ans:
  print(an)

Buggy python submission (verdict: Runtime Error):
n,a,b,c=map(int,input().split())
s=list(input() for i in range(n))
ans=["Yes"]

if a+b+c==0:
  del ans[:]
  ans+=["No"]
  
if a+b+c==1:
  for j in range(n):
    
    if s[j]=="AB":
      if c==1:
        del ans[:]
        ans+=["No"]
        break        
      if a==1:
        a-=1
        b+=1
        ans+="B"
      if b==1:
        a+=1
        b-=1
        ans+="A"

    if s[j]=="AC":
      if b==1:
        del ans[:]
        ans+=["No"]
        break       
      if a==1:
        a-=1
        c+=1
        ans+="C"
      if c==1:
        a+=1
        c-=1
        ans+="A" 

    if s[j]=="BC":
      if a==1:
        del ans[:]
        ans+=["No"]
        break
      if b==1:
        b-=1
        c+=1
        ans+="C"
      if c==1:
        b+=1
        c-=1
        ans+="B"  

if a+b+c==2:
  for j in range(n):
    
    if s[j]=="AB":
      if a==2:
        a-=1
        b+=1
        ans+="B"
      if b==2:
        a+=1
        b-=1
        ans+="A" 
      if c==2:
        del ans[:]
        ans+=["No"]
        break     
      if a==1 and b==1:
        if s[j+1]=="AB" or "AC":
          a+=1
          b-=1
          ans+="A"
        if s[j+1]=="BC":
          a-=1
          b+=1
          ans+="B"
      if a==1 and c==1:
        a-=1
        b+=1
        ans+="B"
      if b==1 and c==1:
        a+=1
        b-=1
        ans+="A"
    
    if s[j]=="AC":
      if a==2:
        a-=1
        c+=1
        ans+="C"
      if c==2:
        a+=1
        c-=1
        ans+="A" 
      if b==2:
        del ans[:]
        ans+="No"
        break     
      if a==1 and c==1:
        if s[j+1]=="AB" or "AC":
          a+=1
          c-=1
          ans+="A"
        if s[j+1]=="BC":
          a-=1
          c+=1
          ans+="C"
      if a==1 and b==1:
        a-=1
        c+=1
        ans+="C"
      if b==1 and c==1:
        a+=1
        c-=1
        ans+="A"

    if s[j]=="BC":
      if c==2:
        c-=1
        b+=1
        ans+="B"
      if b==2:
        c+=1
        b-=1
        ans+="C" 
      if a==2:
        del ans[:]
        ans+="No"
        break     
      if c==1 and b==1:
        if s[j+1]=="AB" or "BC":
          b+=1
          c-=1
          ans+="B"
        if s[j+1]=="AC":
          b-=1
          c+=1
          ans+="C"
      if a==1 and c==1:
        c-=1
        b+=1
        ans+="B"
      if b==1 and a==1:
        c+=1
        b-=1
        ans+="C"        
  print(*ans,sep="\n")

if a+b+c>=3:
  if s[0]=="AB" and a+b==0 or s[0]=="AC" and a+c==0 or s[0]=="BC" and b+c==0:
    del ans[:]
    ans+="No"
  
  else:
    for j in range(n):
      if s[j]=="AB":
        if a>b:
          a-=1
          b+=1
          ans+="B"
        elif a<=b:
          a+=1
          b-=1
          ans+="A"
        
      if s[j]=="AC":
        if a>c:
          a-=1
          c+=1
          ans+="C"
        elif a<=c:
          a+=1
          c-=1
          ans+="A"     

      if s[j]=="BC":
        if b>c:
          b-=1
          c+=1
          ans+="C"
        elif b<=c:
          b+=1
          c-=1
          ans+="B"
for an in ans:
  print(an)

Fixed submission:
n,a,b,c=map(int,input().split())
s=list(input() for i in range(n))+["XX"]
ans=["Yes"]

if a+b+c==0:
  del ans[:]
  ans+=["No"]
  
if a+b+c==1:
  for j in range(n):
    
    if s[j]=="AB":
      if c==1:
        del ans[:]
        ans+=["No"]
        break        
      elif a==1:
        a-=1
        b+=1
        ans+=["B"]
      elif b==1:
        a+=1
        b-=1
        ans+=["A"]

    if s[j]=="AC":
      if b==1:
        del ans[:]
        ans+=["No"]
        break       
      elif a==1:
        a-=1
        c+=1
        ans+=["C"]
      elif c==1:
        a+=1
        c-=1
        ans+=["A"] 

    if s[j]=="BC":
      if a==1:
        del ans[:]
        ans+=["No"]
        break
      elif b==1:
        b-=1
        c+=1
        ans+="C"
      elif c==1:
        b+=1
        c-=1
        ans+=["B"]  

if a+b+c==2:
  for j in range(n):
    if s[j]=="AB":
      if a==2:
        a-=1
        b+=1
        ans+=["B"]
      elif b==2:
        a+=1
        b-=1
        ans+=["A"]
      elif c==2:
        del ans[:]
        ans+=["No"]
        break     
      elif (a==1 and b==1) and (s[j+1]=="AB" or s[j+1]=="AC" or s[j+1]=="XX"):
        a+=1
        b-=1
        ans+=["A"]
      elif (a==1 and b==1) and (s[j+1]=="BC"):
        a-=1
        b+=1
        ans+=["B"]
      elif a==1 and c==1:
        a-=1
        b+=1
        ans+=["B"]
      elif b==1 and c==1:
        a+=1
        b-=1
        ans+=["A"]
    
    if s[j]=="AC":
      if a==2:
        a-=1
        c+=1
        ans+=["C"]
      elif c==2:
        a+=1
        c-=1
        ans+=["A"] 
      elif b==2:
        del ans[:]
        ans+=["No"]
        break     
      elif (a==1 and c==1) and (s[j+1]=="AB" or s[j+1]=="AC" or s[j+1]=="XX"):
        a+=1
        c-=1
        ans+=["A"]
      elif (a==1 and c==1) and (s[j+1]=="BC"):
        a-=1
        c+=1
        ans+=["C"]
      elif a==1 and b==1:
        a-=1
        c+=1
        ans+=["C"]
      elif b==1 and c==1:
        a+=1
        c-=1
        ans+=["A"]

    if s[j]=="BC":
      if c==2:
        c-=1
        b+=1
        ans+=["B"]
      elif b==2:
        c+=1
        b-=1
        ans+=["C"] 
      elif a==2:
        del ans[:]
        ans+=["No"]
        break     
      elif (c==1 and b==1) and (s[j+1]=="AB" or s[j+1]=="BC" or s[j+1]=="XX"):
        b+=1
        c-=1
        ans+=["B"]
      elif (c==1 and b==1) and (s[j+1]=="AC"):
        b-=1
        c+=1
        ans+=["C"]
      elif a==1 and c==1:
        c-=1
        b+=1
        ans+=["B"]
      elif b==1 and a==1:
        c+=1
        b-=1
        ans+=["C"]        

if a+b+c>=3:
  if s[0]=="AB" and a+b==0 or s[0]=="AC" and a+c==0 or s[0]=="BC" and b+c==0:
    del ans[:]
    ans+=["No"]
  
  else:
    for j in range(n):
      if s[j]=="AB":
        if a>b:
          a-=1
          b+=1
          ans+=["B"]
        elif a<=b:
          a+=1
          b-=1
          ans+=["A"]
        
      if s[j]=="AC":
        if a>c:
          a-=1
          c+=1
          ans+=["C"]
        elif a<=c:
          a+=1
          c-=1
          ans+=["A"]     

      if s[j]=="BC":
        if b>c:
          b-=1
          c+=1
          ans+=["C"]
        elif b<=c:
          b+=1
          c-=1
          ans+=["B"]

for an in ans:
  print(an)

Buggy python submission (verdict: Runtime Error):
n,a,b,c=map(int,input().split())
s=list(input() for i in range(n))
ans=["Yes"]

if a+b+c==0:
  print("No")
  
if a+b+c==1:
  for j in range(n):
    
    if s[j]=="AB":
      if c==1:
        ans="No"
        print(ans)
        break        
      else:
        continue
      break
      if a==1:
        a-=1
        b+=1
        ans+="B"
      if b==1:
        a+=1
        b-=1
        ans+="A"

    if s[j]=="AC":
      if b==1:
        ans="No"
        break
        print(ans)        
      if a==1:
        a-=1
        c+=1
        ans+="C"
      if c==1:
        a+=1
        c-=1
        ans+="A" 

    if s[j]=="BC":
      if a==1:
        ans="No"
        print(ans)
        break
      if b==1:
        b-=1
        c+=1
        ans+="C"
      if c==1:
        b+=1
        c-=1
        ans+="B"  
  print(*ans,sep="\n")
if a+b+c==2:
  for j in range(n):
    
    if s[j]=="AB":
      if a==2:
        a-=1
        b+=1
        ans+="B"
      if b==2:
        a+=1
        b-=1
        ans+="A" 
      if c==2:
        ans="No"
        print(ans)
        break     
      if a==1 and b==1:
        if s[j+1]=="AB" or "AC":
          a+=1
          b-=1
          ans+="A"
        if s[j+1]=="BC":
          a-=1
          b+=1
          ans+="B"
      if a==1 and c==1:
        a-=1
        b+=1
        ans+="B"
      if b==1 and c==1:
        a+=1
        b-=1
        ans+="A"
    
    if s[j]=="AC":
      if a==2:
        a-=1
        c+=1
        ans+="C"
      if c==2:
        a+=1
        c-=1
        ans+="A" 
      if b==2:
        ans="No"
        print(ans)
        break     
      if a==1 and c==1:
        if s[j+1]=="AB" or "AC":
          a+=1
          c-=1
          ans+="A"
        if s[j+1]=="BC":
          a-=1
          c+=1
          ans+="C"
      if a==1 and b==1:
        a-=1
        c+=1
        ans+="C"
      if b==1 and c==1:
        a+=1
        c-=1
        ans+="A"

    if s[j]=="BC":
      if c==2:
        c-=1
        b+=1
        ans+="B"
      if b==2:
        c+=1
        b-=1
        ans+="C" 
      if a==2:
        ans="No"
        print(ans)
        break     
      if c==1 and b==1:
        if s[j+1]=="AB" or "BC":
          b+=1
          c-=1
          ans+="B"
        if s[j+1]=="AC":
          b-=1
          c+=1
          ans+="C"
      if a==1 and c==1:
        c-=1
        b+=1
        ans+="B"
      if b==1 and a==1:
        c+=1
        b-=1
        ans+="C"        
  print(*ans,sep="\n")

if a+b+c>=3:
  if s[0]=="AB" and a+b==0 or s[0]=="AC" and a+c==0 or s[0]=="BC" and b+c==0:
    ans="No"
    print(ans)
  
  else:
    for j in range(n):
      if s[j]=="AB":
        if a>b:
          a-=1
          b+=1
          ans+="B"
        elif a<=b:
          a+=1
          b-=1
          ans+="A"
        
      if s[j]=="AC":
        if a>c:
          a-=1
          c+=1
          ans+="C"
        elif a<=c:
          a+=1
          c-=1
          ans+="A"     

      if s[j]=="BC":
        if b>c:
          b-=1
          c+=1
          ans+="C"
        elif b<=c:
          b+=1
          c-=1
          ans+="B"
    print(*ans,sep="\n")

Fixed submission:
n,a,b,c=map(int,input().split())
s=list(input() for i in range(n))+["XX"]
ans=["Yes"]

if a+b+c==0:
  del ans[:]
  ans+=["No"]
  
if a+b+c==1:
  for j in range(n):
    
    if s[j]=="AB":
      if c==1:
        del ans[:]
        ans+=["No"]
        break        
      elif a==1:
        a-=1
        b+=1
        ans+=["B"]
      elif b==1:
        a+=1
        b-=1
        ans+=["A"]

    if s[j]=="AC":
      if b==1:
        del ans[:]
        ans+=["No"]
        break       
      elif a==1:
        a-=1
        c+=1
        ans+=["C"]
      elif c==1:
        a+=1
        c-=1
        ans+=["A"] 

    if s[j]=="BC":
      if a==1:
        del ans[:]
        ans+=["No"]
        break
      elif b==1:
        b-=1
        c+=1
        ans+="C"
      elif c==1:
        b+=1
        c-=1
        ans+=["B"]  

if a+b+c==2:
  for j in range(n):
    if s[j]=="AB":
      if a==2:
        a-=1
        b+=1
        ans+=["B"]
      elif b==2:
        a+=1
        b-=1
        ans+=["A"]
      elif c==2:
        del ans[:]
        ans+=["No"]
        break     
      elif (a==1 and b==1) and (s[j+1]=="AB" or s[j+1]=="AC" or s[j+1]=="XX"):
        a+=1
        b-=1
        ans+=["A"]
      elif (a==1 and b==1) and (s[j+1]=="BC"):
        a-=1
        b+=1
        ans+=["B"]
      elif a==1 and c==1:
        a-=1
        b+=1
        ans+=["B"]
      elif b==1 and c==1:
        a+=1
        b-=1
        ans+=["A"]
    
    if s[j]=="AC":
      if a==2:
        a-=1
        c+=1
        ans+=["C"]
      elif c==2:
        a+=1
        c-=1
        ans+=["A"] 
      elif b==2:
        del ans[:]
        ans+=["No"]
        break     
      elif (a==1 and c==1) and (s[j+1]=="AB" or s[j+1]=="AC" or s[j+1]=="XX"):
        a+=1
        c-=1
        ans+=["A"]
      elif (a==1 and c==1) and (s[j+1]=="BC"):
        a-=1
        c+=1
        ans+=["C"]
      elif a==1 and b==1:
        a-=1
        c+=1
        ans+=["C"]
      elif b==1 and c==1:
        a+=1
        c-=1
        ans+=["A"]

    if s[j]=="BC":
      if c==2:
        c-=1
        b+=1
        ans+=["B"]
      elif b==2:
        c+=1
        b-=1
        ans+=["C"] 
      elif a==2:
        del ans[:]
        ans+=["No"]
        break     
      elif (c==1 and b==1) and (s[j+1]=="AB" or s[j+1]=="BC" or s[j+1]=="XX"):
        b+=1
        c-=1
        ans+=["B"]
      elif (c==1 and b==1) and (s[j+1]=="AC"):
        b-=1
        c+=1
        ans+=["C"]
      elif a==1 and c==1:
        c-=1
        b+=1
        ans+=["B"]
      elif b==1 and a==1:
        c+=1
        b-=1
        ans+=["C"]        

if a+b+c>=3:
  if s[0]=="AB" and a+b==0 or s[0]=="AC" and a+c==0 or s[0]=="BC" and b+c==0:
    del ans[:]
    ans+=["No"]
  
  else:
    for j in range(n):
      if s[j]=="AB":
        if a>b:
          a-=1
          b+=1
          ans+=["B"]
        elif a<=b:
          a+=1
          b-=1
          ans+=["A"]
        
      if s[j]=="AC":
        if a>c:
          a-=1
          c+=1
          ans+=["C"]
        elif a<=c:
          a+=1
          c-=1
          ans+=["A"]     

      if s[j]=="BC":
        if b>c:
          b-=1
          c+=1
          ans+=["C"]
        elif b<=c:
          b+=1
          c-=1
          ans+=["B"]

for an in ans:
  print(an)

Buggy python submission (verdict: Runtime Error):
n,a,b,c=map(int,input().split())
s=list(input() for i in range(n))
ans=["Yes"]

if a+b+c==0:
  ans="No"
  
if a+b+c==1:
  for j in range(n):
    
    if s[j]=="AB":
      if c==1:
        ans="No"
        break
      if a==1:
        a-=1
        b+=1
        ans+="B"
      if b==1:
        a+=1
        b-=1
        ans+="A"

    if s[j]=="AC":
      if b==1:
        ans="No"
        break
      if a==1:
        a-=1
        c+=1
        ans+="C"
      if c==1:
        a+=1
        c-=1
        ans+="A" 
    
    if s[j]=="BC":
      if a==1:
        ans="No"
        break
      if b==1:
        b-=1
        c+=1
        ans+="C"
      if c==1:
        b+=1
        c-=1
        ans+="B"  

if a+b+c==2:
  for j in range(n):
    
    if s[j]=="AB":
      if a==2:
        a-=1
        b+=1
        ans+="B"
      if b==2:
        a+=1
        b-=1
        ans+="A" 
      if c==2:
        ans="No"
        break     
      if a==1 and b==1:
        if s[j+1]=="AB" or "AC":
          a+=1
          b-=1
          ans+="A"
        if s[j+1]=="BC":
          a-=1
          b+=1
          ans+="B"
      if a==1 and c==1:
        a-=1
        b+=1
        ans+="B"
      if b==1 and c==1:
        a+=1
        b-=1
        ans+="A"
    
    if s[j]=="AC":
      if a==2:
        a-=1
        c+=1
        ans+="C"
      if c==2:
        a+=1
        c-=1
        ans+="A" 
      if b==2:
        ans="No"
        break     
      if a==1 and c==1:
        if s[j+1]=="AB" or "AC":
          a+=1
          c-=1
          ans+="A"
        if s[j+1]=="BC":
          a-=1
          c+=1
          ans+="C"
      if a==1 and b==1:
        a-=1
        c+=1
        ans+="C"
      if b==1 and c==1:
        a+=1
        c-=1
        ans+="A"

    if s[j]=="BC":
      if c==2:
        c-=1
        b+=1
        ans+="B"
      if b==2:
        c+=1
        b-=1
        ans+="C" 
      if a==2:
        ans="No"
        break     
      if c==1 and b==1:
        if s[j+1]=="AB" or "BC":
          b+=1
          c-=1
          ans+="B"
        if s[j+1]=="AC":
          b-=1
          c+=1
          ans+="C"
      if a==1 and c==1:
        c-=1
        b+=1
        ans+="B"
      if b==1 and a==1:
        c+=1
        b-=1
        ans+="C"        

if a+b+c>=3:
  if s[0]=="AB" and a+b==0 or s[0]=="AC" and a+c==0 or s[0]=="BC" and b+c==0:
    ans="No"
  
  else:
    for j in range(n):
      if s[j]=="AB":
        if a>b:
          a-=1
          b+=1
          ans+="B"
        if a<b:
          a+=1
          b-=1
          ans+="A"
        
      if s[j]=="AC":
        if a>c:
          a-=1
          c+=1
          ans+="C"
        if a<c:
          a+=1
          c-=1
          ans+="A"     

      if s[j]=="BC":
        if b>c:
          b-=1
          c+=1
          ans+="C"
        if b<c:
          b+=1
          c-=1
          ans+="B"

print(*ans,sep="\n")

Fixed submission:
n,a,b,c=map(int,input().split())
s=list(input() for i in range(n))+["XX"]
ans=["Yes"]

if a+b+c==0:
  del ans[:]
  ans+=["No"]
  
if a+b+c==1:
  for j in range(n):
    
    if s[j]=="AB":
      if c==1:
        del ans[:]
        ans+=["No"]
        break        
      elif a==1:
        a-=1
        b+=1
        ans+=["B"]
      elif b==1:
        a+=1
        b-=1
        ans+=["A"]

    if s[j]=="AC":
      if b==1:
        del ans[:]
        ans+=["No"]
        break       
      elif a==1:
        a-=1
        c+=1
        ans+=["C"]
      elif c==1:
        a+=1
        c-=1
        ans+=["A"] 

    if s[j]=="BC":
      if a==1:
        del ans[:]
        ans+=["No"]
        break
      elif b==1:
        b-=1
        c+=1
        ans+="C"
      elif c==1:
        b+=1
        c-=1
        ans+=["B"]  

if a+b+c==2:
  for j in range(n):
    if s[j]=="AB":
      if a==2:
        a-=1
        b+=1
        ans+=["B"]
      elif b==2:
        a+=1
        b-=1
        ans+=["A"]
      elif c==2:
        del ans[:]
        ans+=["No"]
        break     
      elif (a==1 and b==1) and (s[j+1]=="AB" or s[j+1]=="AC" or s[j+1]=="XX"):
        a+=1
        b-=1
        ans+=["A"]
      elif (a==1 and b==1) and (s[j+1]=="BC"):
        a-=1
        b+=1
        ans+=["B"]
      elif a==1 and c==1:
        a-=1
        b+=1
        ans+=["B"]
      elif b==1 and c==1:
        a+=1
        b-=1
        ans+=["A"]
    
    if s[j]=="AC":
      if a==2:
        a-=1
        c+=1
        ans+=["C"]
      elif c==2:
        a+=1
        c-=1
        ans+=["A"] 
      elif b==2:
        del ans[:]
        ans+=["No"]
        break     
      elif (a==1 and c==1) and (s[j+1]=="AB" or s[j+1]=="AC" or s[j+1]=="XX"):
        a+=1
        c-=1
        ans+=["A"]
      elif (a==1 and c==1) and (s[j+1]=="BC"):
        a-=1
        c+=1
        ans+=["C"]
      elif a==1 and b==1:
        a-=1
        c+=1
        ans+=["C"]
      elif b==1 and c==1:
        a+=1
        c-=1
        ans+=["A"]

    if s[j]=="BC":
      if c==2:
        c-=1
        b+=1
        ans+=["B"]
      elif b==2:
        c+=1
        b-=1
        ans+=["C"] 
      elif a==2:
        del ans[:]
        ans+=["No"]
        break     
      elif (c==1 and b==1) and (s[j+1]=="AB" or s[j+1]=="BC" or s[j+1]=="XX"):
        b+=1
        c-=1
        ans+=["B"]
      elif (c==1 and b==1) and (s[j+1]=="AC"):
        b-=1
        c+=1
        ans+=["C"]
      elif a==1 and c==1:
        c-=1
        b+=1
        ans+=["B"]
      elif b==1 and a==1:
        c+=1
        b-=1
        ans+=["C"]        

if a+b+c>=3:
  if s[0]=="AB" and a+b==0 or s[0]=="AC" and a+c==0 or s[0]=="BC" and b+c==0:
    del ans[:]
    ans+=["No"]
  
  else:
    for j in range(n):
      if s[j]=="AB":
        if a>b:
          a-=1
          b+=1
          ans+=["B"]
        elif a<=b:
          a+=1
          b-=1
          ans+=["A"]
        
      if s[j]=="AC":
        if a>c:
          a-=1
          c+=1
          ans+=["C"]
        elif a<=c:
          a+=1
          c-=1
          ans+=["A"]     

      if s[j]=="BC":
        if b>c:
          b-=1
          c+=1
          ans+=["C"]
        elif b<=c:
          b+=1
          c-=1
          ans+=["B"]

for an in ans:
  print(an)