Harryxun/stf_run huggingface dataset:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
#import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
#sys.setrecursionlimit(10**6)
input=sys.stdin.readline
show_flg=False
#show_flg=True


n,X,Y,Z=MI()

pt=[[0]*11 for _ in range(11)]

for m in range(1,8):
    if m==1:
        for a in range(1,11):pt[m][a]=1
        continue
    for a in range(1,8):
        an=0
        for i in range(1,11):
            if a-i>=0:an+=pt[m-1][a-i]
        pt[m][a]=an
    
def cnt(m,a):
    if m==1:
        pt[1][a]=1
        return a
    if pt[m][a]!=-1:
        return pt[m][a]
    rt=0
    for i in range(1,11):
        if a-i<=0:
            break
        rt+=cnt(m-1,a-i)
    pt[m][a]=rt
    return rt

ans=0
for x in range(n+1):
    for y in range(x+1,n+1):
        for z in range(y+1,n+1):
            for w in range(z+1,n+1):
                p=1
                p*=pt[y-x][X]
                p*=pt[z-y][Y]
                p*=pt[w-z][Z]
                ans+=p*pow(10,n-(w-x),mo)
                show(x,y,z,w,p)

print(ans%mo)

### FIXED CODE ###

from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
#import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
#ts=time.time()
#sys.setrecursionlimit(10**6)
input=sys.stdin.readline
show_flg=False
#show_flg=True

n,X,Y,Z=MI()
t=1<<(X+Y+Z)
haiku=( (1<<(X+Y+Z)) + (1<<(Y+Z)) + (1<<Z) )>>1
dp=[0]*t
dp[0]=1


for i in range(n):
    tm=[i for i in dp]
    dp=[0]*t
    for k in range(t):
        for d in range(10):
            m=((k<<(d+1))+(1<<d))
            if m&haiku == haiku:
                continue
            else:
                dp[int(m)%t]+=tm[k]
                dp[int(m)%t]%=mo
sub=0
for i in range(t):
    sub+=dp[i]
ans=pow(10,n,mo)-sub
print(ans%mo)

show(ans,sub)
show(dp)
show(n,t,n*t*10)
N, M = map(int, input().split())
a_list =  list(map(int, input().split()))
a_total = sum(a_list)
ld = sorted(a_list, reverse = True)
for i in ld[:M]:
    if i < (1/(4*M))*a_total:
    	print("No")
        break
else:
    print("Yes")

### FIXED CODE ###

N, M = map(int, input().split())
a_list =  list(map(int, input().split()))
a_list.sort(reverse = True)
a_total = sum(a_list)
count = 0
for voted in a_list[:M]:
  if voted < (1/(4*M))*a_total:
    print("No")
    break
else:
  print("Yes")
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
X=input()
def popcount(x):
  x=x-((x>>1)&0x5555555555555555)
  x=(x&0x3333333333333333)+((x>>2)&0x3333333333333333)

  x=(x+(x>>4))&0x0f0f0f0f0f0f0f0f
  x=x+(x>>8)
  x=x+(x>>16)
  x=x+(x>>32)
  return x&0x0000007f

F=[0]*(n+1)
F[1]=1
F[2]=1
for i in range(3,n+1):
  F[i]=1+F[i%popcount(i)]

ct=X.count("1")
if ct==0:
  for _ in range(n):
    print(1)
else:
  a,b=0,0
  for i in range(n):
    if X[n-1-i]=="1":
      a=(a+pow(2,i,ct-1))%(ct-1)
      b=(b+pow(2,i,ct+1))%(ct+1)
  for i in range(n):
    if X[i]=="0":
      print(F[(b+pow(2,n-1-i,ct+1))%(ct+1)]+1)
    else:
      print(F[(a-pow(2,n-1-i,ct-1))%(ct-1)]+1)

### FIXED CODE ###

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
X=input()
def popcount(x):
  x=x-((x>>1)&0x5555555555555555)
  x=(x&0x3333333333333333)+((x>>2)&0x3333333333333333)

  x=(x+(x>>4))&0x0f0f0f0f0f0f0f0f
  x=x+(x>>8)
  x=x+(x>>16)
  x=x+(x>>32)
  return x&0x0000007f

F=[0]*(n+1)
F[1]=1
for i in range(2,n+1):
  F[i]=1+F[i%popcount(i)]

ct=X.count("1")
if ct==0:
  for _ in range(n):
    print(1)
elif ct==1:
  for i in range(n):
    if X[i]=="1":
      cur=i
      break
  for i in range(n):
    if i==cur:
      print(0)
    else:
      if i==n-1 or cur==n-1:
        print(2)
      else:
        print(1)

else:
  a,b=0,0
  for i in range(n):
    if X[n-1-i]=="1":
      a=(a+pow(2,i,ct-1))%(ct-1)
      b=(b+pow(2,i,ct+1))%(ct+1)
  for i in range(n):
    if X[i]=="0":
      print(F[(b+pow(2,n-1-i,ct+1))%(ct+1)]+1)
    else:
      print(F[(a-pow(2,n-1-i,ct-1))%(ct-1)]+1)
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    import queue
    mod=10**9+7
    N,K=MI()

    #0~Nまで逆元などを事前計算

    def calc(n, r, mod):
        if (r < 0) or (n < r):
            return 0
        return (fact[n] * factinv[n-r])%mod

    fact=[1,1]
    factinv=[1,1]
    inv=[0,1]

    for i in range(2, K + 1):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)
    
    adj=[[]for _ in range(N)]
    for i in range(N-1):
        a,b=MI()
        a-=1
        b-=1
        adj[a].append(b)
        adj[b].append(a)
    
    #子要素を全部いっぺんに塗る
    ans=K#根の塗り方
    
    q=queue.Queue()
    q.put((0,0,-1))
    
    while not q.empty():
        v,d,p=q.get()
        cnt=0#子の個数
        for nv in adj[v]:
            if nv!=p:
                cnt+=1
                q.put((nv,d+1,v))
            
        if cnt!=0:#葉以外の場合は計算
            np=2#親方向で気にすべき個数
            if d==0:
                np=1#根の親はいない
                
        ans=(ans*calc(K-np,cnt,mod))%mod
        
    print(ans)

        
    

main()


### FIXED CODE ###

#頂点を見た時に，枝分かれの本数に応じてansを更新
#permutationのリストを先に作っておく

import sys
input = sys.stdin.readline

mod=10**9+7


N,K=map(int,input().split())
ab=[list(map(int, input().split())) for _ in range(N - 1)]
adj=[[] for _ in range(N)]

for a,b in ab:
    adj[a-1].append(b-1)
    adj[b-1].append(a-1)
    
    
#順列(K-2)Piを先に
P=[1]
for i in range(N):
    P.append((P[-1]*(K-2-i))%mod)
    

q=[(0,-1,0)]#node,parent,depth

ans=1
while q!=[]:
    v,p,d=q.pop()
    #深さ0or1で塗ることができる色数は異なる
    l=len(adj[v])
    if d==0:
        ans*=(K-1)
    ans*=(P[l-1])
    ans%=mod
    for i in range(l):
        next_v=adj[v][i]
        #葉は追加しない
        if next_v!=p and len(adj[next_v])!=1:
            q.append((next_v,v,d+1))
if N==1:
    ans=1
print((ans*K)%mod)
S = input()
if S == ABC:
    print(ARC)
else:
    print(ABC)

### FIXED CODE ###

S = input()
if S == "ABC":
    print('ARC')
else:
    print('ABC')
d,n=map(int,input().split())
print(100**d*n)d,n=map(int,input().split())
if n==100:
    print(100**d*(n+1))
else:
    print(100**d*n)

### FIXED CODE ###

d,n=map(int,input().split())
if n==100:
    print(100**d*(n+1))
else:
    print(100**d*n)
a, b, k = map(int, input().split())
for i in range(k):
  if a > 0:
    a -= 1 
  elif b > 0:
    b -= 1
  else:
    break
print(str(a) + " " + str(b))

### FIXED CODE ###

s, t = input().split()
print(t+s)
a, b, c, d, e=(int(x) in input().split())
list=[a, b, c, d, e]
for num in list:
  if num=1:
    print((list.index(num))+1)
    

### FIXED CODE ###

a,b,c,d,e=(int(x) for x in input().split())
if a==0:
  print(1)
elif b==0:
  print(2)
elif c==0:
  print(3)
elif d==0:
  print(4)
elif e==0:
  print(5)
A=sum(list(map(int,input().stlip()))
      
      if A <=21:
      	print('win')
      else:
      	print('bust')

### FIXED CODE ###

A = sum(list(map(int, input().split())))
 
print("bust") if A >= 22 else print("win")
import sys
input = sys.stdin.readline
import numpy as np

def print_sub(A, m, c):
    A = np.array(A)
    A -= 1
    print(m -np.nonzero(A)[0].size)
    c +=1
    if c < m:
        return print_sub(A, m, c)
    else:
        return

n= int(input())
A = [int(a) for a in input().split()]
c = 0
print_sub(A, n-1, c)

print("0")


### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
A = [int(a) for a in input().split()]

sub_list = [0] *n

for a in A:
  sub_list[a-1] +=1

for i in range(n):
  print(sub_list[i])
a, v = map(int, input().split())
b, w = map(int, input().split())

t = int(input())


if (v <= w and a < b):
  ans = t + 1
else:
  ans = (b - a) / (v - w)


if t >= ans:
  print("YES")
else:
  print("NO")



### FIXED CODE ###

a, v = map(int, input().split())
b, w = map(int, input().split())

t = int(input())

if v <= w:
  print("NO")

else:
  ans = (b - a) / (v - w)
  if t >= abs(ans):
    print("YES")
  else:
    print("NO")
r=int(input)
print(r**2)

### FIXED CODE ###

r=int(input())
print(r**2)
# coding: utf-8
def dfs(i,f,sum):#ストップする段階（i）、式（f）、sumカウンタの3つの引数を用意。
    if i == 3:
        if sum==7:
            print(f+"=7")
            exit()
    
    return dfs(i+1, f+"+"+s[i+1],sum+int(s[i+1]))
    dfs(i+1, f+"-"+s[i+1],sum-int(s[i+1]))

s=input()
dfs(0, s[0],int(s[0]))


### FIXED CODE ###

def resolve():
    I = input()
    L = [int(c) for c in I]
    # bit全探索
    # https://qiita.com/gogotealove/items/11f9e83218926211083a#%E4%BE%8B%E9%A1%8C-1
    for i in range(2 ** 3):
        val=L[0]
        ans=[]
        for j in range(3):  # このループが一番のポイント
            if ((i >> j) & 1):
                val+=L[j+1]
                ans.append('+')
            else:
                val-=L[j+1]
                ans.append('-')
                # 順に右にシフトさせ最下位bitのチェックを行う
        if val==7:
            for k in range(3):
                print('{}{}'.format(L[k],ans[k]),end='')
            print('{}=7'.format(L[3]))
            break





resolve()
import numpy as np

N=int(input())

X=[]
for x in range(N):
    X.append(int(input()))

Y=[]
Y=np.sort(X)[::-1]

for i in range(N):
    ans=s[0]
    if ans==X[i]:
        ans=s[1]
    print(ans)


### FIXED CODE ###

import numpy as np

N=int(input())

X=[]
for x in range(N):
    X.append(int(input()))

Y=[]
Y=np.sort(X)[::-1]

for i in range(N):
    ans=Y[0]
    if ans==X[i]:
        ans=Y[1]
    print(ans)
N=int(input())
print(N*(N+1)*(2*n+1)//6)

### FIXED CODE ###

R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0
    while r*R + g*G <= N:
        if (N - r*R - g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
import collections
import collections, heapq, itertools, bisect
import math, fractions
import sys, copy
from sortedcontainers import SortedSet

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline().strip())
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline().strip())
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
MOD = 1000000007

def main():
    s = S()
    print(s)
    

main()


### FIXED CODE ###

A, B, C = map(int, input().split())
print(C, A, B)
A = str(input())
AC = list(A)
AB = A[0] + A[1]
AC = A[2] + A[3]

if 1 <= AB <= 12:
    if 1 <= AC <= 99:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 1 <= AC <= 12:
     if 1 <= AB <= 99:
        print("AMBIGUOUS")
    else:
        print("YYMM")
elif AB == 0 or AB >= 13:
    if AC == 0 or AC >= 13:
        print("NA")

### FIXED CODE ###

A = str(input())
AC = list(A)
AB = int(A[0] + A[1])
AC = int(A[2] + A[3])

if 1 <= AB <= 12 and 1 <= AC <= 12:
    print("AMBIGUOUS")
elif 1 <= AB <= 12:
    print("MMYY")
elif 1 <= AC <= 12:
    print("YYMM")
else:
    print("NA")
N, T = map(int, input().split())
c = 1001
for i in range(N):
  c, t = map(int, input().split())
  if t <= T:
    ans = min(ans, c)
print(ans) if c < 1001 else print("TLE")

### FIXED CODE ###

N, T = map(int, input().split())
ans = 1001
for i in range(N):
  c, t = map(int, input().split())
  if t <= T:
    ans = min(ans, c)
print(ans) if ans < 1001 else print("TLE")
n, t = map(int, input().split())
c_t = [list(map(int, input().split())) for _ in range(n)]

cost = []

for i in range(n):
    if c_t[i][1] <= t:
        cost.append(c_t[i][0])
print(min(cost))

### FIXED CODE ###

n, t = map(int, input().split())
c_t = [list(map(int, input().split())) for _ in range(n)]

cost = []

for i in range(n):
    if c_t[i][1] <= t:
        cost.append(c_t[i][0])
if len(cost) == 0:
    print("TLE")
else:
    print(min(cost))
import itertools
import math
N = int(input())
p = []
for i in range(N):
    x, y = map(int, input().split())
    p.append([x, y])
ans = 10000
if len(p) >= 3:
    S = list(itertools.combinations(p,3))
    for X in S:
        ok = True
        a = X[0][0]
        b = X[0][1]
        c = X[1][0]
        d = X[1][1]
        e = X[2][0]
        f = X[2][1]
        py = ((e-a)*(a**2+b**2-c**2-d**2)-(c-a)*(a**2+b**2-e**2-f**2))/(2*(e-a)*(b-d)-2*(c-a)*(b-f))
        if c == a:
            px = (2*(b-f)*py-(a**2+b**2-e**2-f**2))/(2*(e-a))
        else:
            px = (2*(b-d)*py-(a**2+b**2-c**2-d**2))/(2*(c-a))
        r = math.sqrt((px-a)**2+(py-b)**2)
        for Y in p:
            if r**2 < (px-Y[0])**2 + (py-Y[1])**2:
                ok = False
        if ok:
            ans = min(ans, r)
T = list(itertools.combinations(p,2))
for X in T:
    a = X[0][0]
    b = X[0][1]
    c = X[1][0]
    d = X[1][1]
    ok = True
    px = (a+c)/2
    py = (b+d)/2
    r = math.sqrt((px-a)**2+(py-b)**2)
    for Y in p:
        if r**2 < (px-Y[0])**2 + (py-Y[1])**2:
            ok = False
    if ok:
        ans = min(ans, r)
print(ans)

### FIXED CODE ###

import itertools
import math
N = int(input())
p = []
for i in range(N):
    x, y = map(int, input().split())
    p.append([x, y])
ans = 10000
if len(p) >= 3:
    S = list(itertools.combinations(p,3))
    for X in S:
        ok = True
        a = X[0][0]
        b = X[0][1]
        c = X[1][0]
        d = X[1][1]
        e = X[2][0]
        f = X[2][1]
        if (a-c)*(b-f) == (a-e)*(b-d):
            continue
        py = ((e-a)*(a**2+b**2-c**2-d**2)-(c-a)*(a**2+b**2-e**2-f**2))/(2*(e-a)*(b-d)-2*(c-a)*(b-f))
        if c == a:
            px = (2*(b-f)*py-(a**2+b**2-e**2-f**2))/(2*(e-a))
        else:
            px = (2*(b-d)*py-(a**2+b**2-c**2-d**2))/(2*(c-a))
        r = math.sqrt((px-a)**2+(py-b)**2)
        for Y in p:
            if not (r+0.000001)**2 >= (px-Y[0])**2 + (py-Y[1])**2:
                ok = False
        if ok:
            ans = min(ans, r)
T = list(itertools.combinations(p,2))
for X in T:
    a = X[0][0]
    b = X[0][1]
    c = X[1][0]
    d = X[1][1]
    ok = True
    px = (a+c)/2
    py = (b+d)/2
    r = math.sqrt((px-a)**2+(py-b)**2)
    for Y in p:
        if not (r+0.000001)**2 >= (px-Y[0])**2 + (py-Y[1])**2:
            ok = False
    if ok:
        ans = min(ans, r)
print(ans)
Ns = input()
N = int(Ns)
if(N % 2 == 1):
  if(N == 1):
    prrint(N)
  else:
    print((N-1)/N)
else:
  print(1/2)
  

### FIXED CODE ###

Ns = input()
N = int(Ns)
if(N % 2 == 1):
  if(N == 1):
    print('{:.7f}'.format(N))
  else:
    print('{:.7f}'.format(((N+1)/2)/N))
else:
  print('{:.7f}'.format(1/2))
s=str(input())
y=700
x=0
while x!=2
if s[x]=o：
　　　y+100
x+=1
break
print(y)

### FIXED CODE ###

S = input()
s = S.count('o')*100
 
print(700+s)
import sys
sys.setrecursionlimit("10**7")

N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
  if cur == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
  if cur == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))
A,B,K=map(int,input().split())
nums = list(range(A,B+1))
result = set()
L = min(B-A+1,K)
for i in range(L):
    result.add(nums[i])
for j in range(1,L+1):
    result.add(nums[-j])
for x in result:
    print(x)

### FIXED CODE ###

A,B,K=map(int,input().split())
result = []
L = min(B-A+1,K)
for i in range(A,A+L):
    if i not in result:
        result.append(i)
for j in range(B,B-L,-1):
    if j not in result:
        result.append(j)
result.sort()
for x in result:
    print(x)
n, m, l = [int(i) for i in input().split()]
c = [[0] * l for _ in range(n)]

A = [(int(i) for i in input().split()) for i in range(n)]
B = [(int(i) for i in input().split()) for i in range(m)]
C = [(A + B)]

for ni in range(n):
    A.append([int(i) for i in input().split()])
    c[n][m] = sum([A[n][m] * B[m][l] for m in range(m)])
    

for mi in range(m):
    B.append([int(i) for i in input().split()])
    for c in (n, m, l):
        print(" ".join([str(v) for v in c]))

### FIXED CODE ###

n, m, l = [int(i) for i in input().split()]

A = []
B = []
C = []

for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i) for i in input().split()])

for i in range(n):
    C.append([])
    for j in range(l):
        C[i].append(0)
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]

for li in range(n):
    print(" ".join([str(s) for s in C[li]]))
N = int(input())
S = list(input())
r = S.count("R")
g = S.count("G")
b = S.count("B")
 
ans = r*g*b
for i in range(N-2):
  for j in range(i+1, N-1):
    k = 2*j-i
    if k <= N-1:
      if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
        ans -= 1
 
print(ans

### FIXED CODE ###

N = int(input())
A = list(input())
ans = A.count("R")*A.count("G")*A.count("B")
for i in range(N-2):
  for j in range(i+1, N-1):
    k = 2*j-i
    if k<N and A[k] != A[i] and A[k] != A[j] and A[i] != A[j]:
      ans -= 1
print(ans)
X = [0, 0, 0]
N, X[0], X[1], X[2] = map(int, input().split())
Q = []
for _ in range(N):
    s = input()
    if s == 'AB':
        Q.append([0, 1])
    elif s == 'AC':
        Q.append([0, 2])
    else:
        Q.append([1, 2])
ans = True
ret = ''
for i in range(N):
    a = Q[i][0]
    b = Q[i][1]
    if X[a] == X[b] == 0:
        ans = False
        break
    elif X[a] < X[b]:
        ret += chr(ord(str(a)) + 17)
        X[a] += 1
        X[b] -= 1
    elif X[a] > X[b] or i == N - 1:
        ret += chr(ord(str(b)) + 17)
        X[a] -= 1
        X[b] += 1
    else:
        s = Q[i + 1][0]
        t = Q[i + 1][1]
        if a == s or a == t:
            ret += chr(ord(str(a)) + 17)
            X[a] += 1
            X[b] -= 1
        else:
            ret += chr(ord(str(b)) + 17)
            X[a] -= 1
            X[b] += 1
    print(X, ret)
    if X[a] < 0 or X[b] < 0:
        ans = False
        break
if ans:
    print('Yes')
    print('\n'.join(ret))
else:
    print('No')

### FIXED CODE ###

X = [0, 0, 0]
N, X[0], X[1], X[2] = map(int, input().split())
Q = []
for _ in range(N):
    s = input()
    if s == 'AB':
        Q.append([0, 1])
    elif s == 'AC':
        Q.append([0, 2])
    else:
        Q.append([1, 2])
ans = True
ret = ''
for i in range(N):
    a = Q[i][0]
    b = Q[i][1]
    if X[a] == X[b] == 0:
        ans = False
        break
    elif X[a] < X[b]:
        ret += chr(ord(str(a)) + 17)
        X[a] += 1
        X[b] -= 1
    elif X[a] > X[b] or i == N - 1:
        ret += chr(ord(str(b)) + 17)
        X[a] -= 1
        X[b] += 1
    else:
        s = Q[i + 1][0]
        t = Q[i + 1][1]
        if a == s or a == t:
            ret += chr(ord(str(a)) + 17)
            X[a] += 1
            X[b] -= 1
        else:
            ret += chr(ord(str(b)) + 17)
            X[a] -= 1
            X[b] += 1
    if X[a] < 0 or X[b] < 0:
        ans = False
        break
if ans:
    print('Yes')
    print('\n'.join(ret))
else:
    print('No')
import itertools
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
L = list(map(list,list(itertools.permutations(list(i for i in range(1,N+1)),N))))
a = L.index(P)
b = L.index(Q)
print(abs(a-b))

### FIXED CODE ###

N = int(input())
S = str(input())
print(S.count("ABC"))
from collections import defaultdict
S = input()
N = len(S)

D=defaultdict()
prev=0
ans=0
for i,s in enumerate(reversed(S)):
    cur=prev+pow(10,i,2019)*int(s)%2019
    ans+=D[cur]
    D[cur]+=1
    prev=cur
print(ans)


### FIXED CODE ###

S,W = map(int,input().split())
if W>=S:
    print("unsafe")
else:
    print("safe")
import sys

N, A, B = map(int, sys.argv[1:])
return min(N*A, B)

### FIXED CODE ###

import sys

for line in sys.stdin:
  N, A, B = map(int, line.split())

print min(N*A, B)
a,b=input().split()
c=int("a"+"b")
if c**0.5 % 1 !=0:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

c=int(input().replace(" ",""))
if c**0.5 % 1 !=0:
  print("No")
else:
  print("Yes")
is_lucky = any(i == "7" for i in input().split())
print("Yes" if is_luckey else "No")


### FIXED CODE ###

numbers = [i for i in input()]
print("Yes" if "7" in numbers else "No")
a, b, k = map(int, input().split())
for i in list(range(k)):
    print(a + i)



for j in list(range(k - 1, -1, -1)):
    print(b-j)

### FIXED CODE ###

a,b,k = map(int, input().split())
n = a
c = 1
while n <= b:
    print(n)
    n += 1
    c += 1
    if c > k:
        break
if n <= (b - k):
    n = b - k + 1

c = 1
while n <= b:
    print(n)
    n += 1
    c += 1
    if c > k:
        break
info = input().split(" ")
N = int(info[0])
A = int(info[1])
B = int(info[2])

if N*A =< B:
  print(N*A)
else:
  print(B)


### FIXED CODE ###

info = input().split(" ")
N = int(info[0])
A = int(info[1])
B = int(info[2])

if N*A <= B:
  print(N*A)
else:
  print(B)
n = int(input())
for i in reversed(range(int(n**0.5))):
    if n%i==0:
        print(max(len(str(i)), len(str(n//i))))
        exit()


### FIXED CODE ###

n = int(input())
for i in reversed(range(int(n**0.5)+1)):
    if n%i==0:
        print(max(len(str(i)), len(str(n//i))))
        exit()
k=0

for i in range(N+1):
    k +=i
    
print(k)

### FIXED CODE ###

N=int(input())
k=0

for i in range(N+1):
    k +=i
    
print(k)
print(input()[{
  "SAT": 1 
  "FRI": 2,
  "THU": 3,
  "WED": 4,
  "TUE": 5,
  "MON": 6,
  "SUN": 7
}])

### FIXED CODE ###

print({
  "SAT": 1,
  "FRI": 2,
  "THU": 3,
  "WED": 4,
  "TUE": 5,
  "MON": 6,
  "SUN": 7
}[input()])
s = input()
k = int(input())
for i in range(k+1):
    if s[i] == '1':
        continue
    else:
        print(s[i])
        break
else:
    print('1')

### FIXED CODE ###

s = input()
k = int(input())
s = s[:k]
for c in s:
    if c == '1':
        continue
    else:
        print(c)
        break
else:
    print(1)