Harryxun/stf_run huggingface dataset:
a =[]

for i in range(3):
    a .append(list(map(int, input().split())))


n = int(input())
b =[]

for i in range(n):
    b.append(int(input()))



flag = 0
cnt = 0
# yoko
for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            cnt += 1
    else:
        if cnt == 3:
            print("Yes")
            flag += 1
            exit()
        else:
            cnt = 0

# tate
if flag == 0:
    for i in range(3):
        for j in range(3):
            if a[j][i] in b:
                cnt += 1

        else:
            if cnt == 3:
                print("Yes")
                flag += 1
                exit()
            else:
                cnt = 0


# ななめ1
if flag == 0:
    for i in range(3):
        if a[i][i] in b:
             cnt += 1
    else:
        if cnt == 3:
            print("Yes")
            flag += 1
            exit()
        else:
            cnt = 0

# ななめ2
if flag == 0:
    if a[3][1] in b:
        if a[2][2] in b:
            if a[1][3] in b:
                print("Yes")
                flag += 1


if flag == 0:
    print("No")


### FIXED CODE ###

a =[]

for i in range(3):
    a .append(list(map(int, input().split())))


n = int(input())
b =[]

for i in range(n):
    b.append(int(input()))



flag = 0
cnt = 0
# yoko
for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            cnt += 1
    else:
        if cnt == 3:
            print("Yes")
            flag += 1
            exit()
        else:
            cnt = 0

# tate
if flag == 0:
    for i in range(3):
        for j in range(3):
            if a[j][i] in b:
                cnt += 1

        else:
            if cnt == 3:
                print("Yes")
                flag += 1
                exit()
            else:
                cnt = 0


# ななめ1
if flag == 0:
    for i in range(3):
        if a[i][i] in b:
             cnt += 1
    else:
        if cnt == 3:
            print("Yes")
            flag += 1
            exit()
        else:
            cnt = 0

# ななめ2
if flag == 0:
    if a[2][0] in b:
        if a[1][1] in b:
            if a[0][2] in b:
                print("Yes")
                flag += 1


if flag == 0:
    print("No")
def main():
    from functools import reduce
    from math import gcd

    n, *a = map(int, open(0).read().split())
    g = [reduce(gcd, a[:i]+a[i+1:]) for i in range(n)]
    ans = max(g)
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from fractions import gcd

    n, *a = map(int, open(0).read().split())
    a = [0] + a + [0]
    l = [0 for _ in range(n + 1)]
    r = [0 for _ in range(n + 1)]
    tmpl = 0
    tmpr = 0
    for i in range(1,n+1):
        tmpl = gcd(tmpl, a[i-1])
        tmpr = gcd(tmpr, a[-i])
        l[i] = tmpl
        r[-i] = tmpr

    ans = 0
    for i, j in zip(l, r):
        g = gcd(i, j)
        ans = max(ans, g)

    print(ans)


if __name__ == '__main__':
    main()
from collections import deque
X,Y,A,B,C = (int(i) for i in input().split())

P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
P_deque = deque(P)
Q_deque = deque(Q)
R_deque = deque(R)

red_counter = 0
green_counter = 0

ans = 0

for i in range(X+Y):
  if red_counter == X:
    P_deque = [-1]
  elif green_counter == Y:
    Q_deque = [-1]

  if len(R) != 0:
    if P_deque[0] >= Q_deque[0] and P_deque[0] >= R_deque[0]:
      ans += P_deque.popleft()
      red_counter += 1
    elif Q_deque[0] >= P_deque[0] and Q_deque[0] >= R_deque[0]:
      ans += Q_deque.popleft()
      green_counter +=1
    else:
      ans += R_deque.popleft()

print(ans)


### FIXED CODE ###

from collections import deque
X,Y,A,B,C = (int(i) for i in input().split())

P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
P_deque = deque(P)
Q_deque = deque(Q)
R_deque = deque(R)

red_counter = 0
green_counter = 0

ans = 0

for i in range(X+Y):
  if red_counter == X:
    P_deque = [-1]
  elif green_counter == Y:
    Q_deque = [-1]

  if len(R_deque) != 0:
    if P_deque[0] >= Q_deque[0] and P_deque[0] >= R_deque[0]:
      ans += P_deque.popleft()
      red_counter += 1
    elif Q_deque[0] >= P_deque[0] and Q_deque[0] >= R_deque[0]:
      ans += Q_deque.popleft()
      green_counter +=1
    else:
      ans += R_deque.popleft()
  else:
    if P_deque[0] >= Q_deque[0]:
      ans += P_deque.popleft()
      red_counter += 1
    elif Q_deque[0] >= P_deque[0]:
      ans += Q_deque.popleft()
      green_counter +=1

print(ans)
while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break

    for h in range(H):
        for w in range(w):
            if (h + w) % 2 == 0:
                print('#', end='')
            else:
                print('.', end='')

        print()

### FIXED CODE ###

while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break

    for h in range(H):
        for w in range(W):
            if (h + w) % 2 == 0:
                print('#', end='')
            else:
                print('.', end='')

        print()
    print()
h,w=map(int,input().split())
lst=list(input() for i in range(h))
n_h=h
for i in range(len(lst)):
    if "#" not in lst[h-i-1]:
        n_h-=1
        lst.pop(h-i-1)
lst=list(map(list,lst))
for i in range(w):
    T=True
    for b in range(n_h):
        if lst[b][w-i-1]=="#":
            T=False
            break
    if T:
        for b in range(h):
            lst[b].pop(w-i-1)
for b in range(h):
    print("".join(lst[b]))

### FIXED CODE ###

h,w=map(int,input().split())
lst=list(input() for i in range(h))
n_h=h
for i in range(len(lst)):
    if "#" not in lst[h-i-1]:
        n_h-=1
        lst.pop(h-i-1)
h=n_h
n_w=w
lst=list(map(list,lst))
for i in range(w):
    T=True
    for b in range(h):
        if lst[b][w-i-1]=="#":
            T=False
            break
    if T:
        for b in range(h):
            lst[b].pop(w-i-1)
            n_w-=1
for b in range(h):
    print("".join(lst[b]))
h,n=map(int, input().split()) 
ab=[list(map(int, input().split())) for _ in range(n)] 

INF = 10**18
dp = [INF]*(h+1)
#dp[i]: hpがiの相手に消費する魔力の最小値
dp[0]=0

for i in range(h):#i:累積ダメージi
    for j in range(n):#
        if i+A[j]<=h: #
            dp[i+A[j]]=min(dp[i+A[j]],dp[i]+B[j])
        else:
            dp[-1]=min(dp[-1],dp[i]+B[j])
print(dp[-1])

### FIXED CODE ###

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

INF = 10**18
dp = [INF]*(h+1)
#dp[i]: hpがiの相手に消費する魔力の最小値
dp[0]=0

for i in range(h):#i:累積ダメージi
    for j in range(n):#
        if i+ab[j][0]<=h: #
            dp[i+ab[j][0]]=min(dp[i+ab[j][0]],dp[i]+ab[j][1])
        else:
            dp[-1]=min(dp[-1],dp[i]+ab[j][1])
print(dp[-1])
N,T = map(int,input().split())
list_aaa = [list(map(int,input().split())) for i in range(N)]

min_aaa =1001

for i in range(N):
    if T>= list_aaa[i][1]:
        min_aaa = min(min_aaa,list_aaa[i][1])

if min_aaa ==1001:
    print(TLE)
else:
    print(min_aaa)




### FIXED CODE ###

N,T = map(int,input().split())
list_aaa = [list(map(int,input().split())) for i in range(N)]

min_aaa =1001

for i in range(N):
    if T>= list_aaa[i][1]:
        min_aaa = min(min_aaa,list_aaa[i][0])

if min_aaa ==1001:
    print("TLE")
else:
    print(min_aaa)
import numpy as np
N, K= map(int, input().split())
A=[int(i) for i in input().split()]
F=[int(i) for i in input().split()]

A=np.array(sorted(A, reverse=True))
F=np.array(sorted(F))

lower_bound=0
upper_bound=np.max(A*F)
K_tmp=0

while upper_bound>=lower_bound:
    mid=(lower_bound+upper_bound)//2
    K_tmp=np.sum(np.maximum(A-mid//F, 0))
    if K_tmp<=K:
        upper_bound=mid-1
    else:
        lower_bound=mid+1

print(lower_bound)


### FIXED CODE ###

import numpy as np
N, K= map(int, input().split())
A=[int(i) for i in input().split()]
F=[int(i) for i in input().split()]

A=np.array(sorted(A, reverse=True))
F=np.array(sorted(F))

lower_bound=0
upper_bound=np.max(A*F)
K_tmp=0

while upper_bound>=lower_bound:
    mid=(lower_bound+upper_bound)//2
    K_tmp=np.sum(np.maximum(A-mid//F, 0))
    if K_tmp<=K:
        upper_bound=mid-1
    else:
        lower_bound=mid+1

print(lower_bound)
import sys
HK,WK,M = map(int, input().split())
W = [0] * WK + 1
H = [0] * HK + 1
HW = [[0 for i in range(WK+1)] for _ in range(HK+1)]
# 3*10^5

for i in range(M):
    h, w = map(int, input().split())

    H[h] += 1
    W[w] += 1

    HW[h][w] = 1

answer = 0
HMAX = max(H)
WMAX = max(W)

HEMAX = H.count(HMAX)
WEMAX = W.count(WMAX)
if HEMAX * WEMAX > M:
    print(HMAX + WMAX)
    sys.exit(0)

HMAXES = [i for i, _ in enumerate(H) if _ == HMAX]
WMAXES = [i for i, _ in enumerate(W) if _ == WMAX]

# 3*10^5
answer = HMAX + WMAX
for h in HMAXES:
    for w in WMAXES:
        if HW[h][w] == 0:
            print(answer)
            sys.exit(0)
print(answer-1)

### FIXED CODE ###

import sys
HK,WK,M = map(int, input().split())
W = [0] * (WK + 1)
H = [0] * (HK + 1)
HW = {}
# 3*10^5

for i in range(M):
    h, w = map(int, input().split())

    H[h] += 1
    W[w] += 1

    HW[(h,w)] = 1

answer = 0
HMAX = max(H)
WMAX = max(W)

HEMAX = H.count(HMAX)
WEMAX = W.count(WMAX)
if HEMAX * WEMAX > M:
    print(HMAX + WMAX)
    sys.exit(0)

HMAXES = [i for i, _ in enumerate(H) if _ == HMAX]
WMAXES = [i for i, _ in enumerate(W) if _ == WMAX]

# 3*10^5
answer = HMAX + WMAX
for h in HMAXES:
    for w in WMAXES:
        if not (h,w) in HW:
            print(answer)
            sys.exit(0)
print(answer-1)
n = int(input())
v = map(int,input().split())
c = map(int,input().split())
cnt = 0
for i in range(len(n)):
    if v[i] > c[i]:
        cnt += (v[i] - c[i])
    else:
        cnt += 0
print(cnt) 

### FIXED CODE ###

n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
cnt = 0
for i in range(n):
    if v[i] > c[i]:
        cnt += (v[i] - c[i])
print(cnt)
from collections import deque
#import numpy as np

H, W = map(int, input().split())
H += 2; W += 2
grid = []
grid.append("#" * W)
for h in range(H-2):
  grid.append("#" + input() + "#")
grid.append("#" * W)

INF = -1
ans = 0
for h in range(1, H-1):
  for w in range(1, W-1):
    
    if grid[h][w]=="#": continue

    dist = np.array([[INF]*W for i in range(H)])
    dist[h][w] = 0 
    q = deque([(h,w)])

    while(q):
      v_h, v_w = q.popleft()
      d_v = dist[v_h][v_w]
      for n_h, n_w in ((v_h, v_w-1),(v_h, v_w+1),(v_h-1, v_w),(v_h+1, v_w)):
        if grid[n_h][n_w]=="#": continue
        d_v = dist[v_h][v_w]
        d_n = d_v + 1
        if (dist[n_h][n_w] == -1) & (d_n > dist[n_h][n_w]):
          continue
        
        dist[n_h][n_w] = d_n
        q.append((n_h,n_w))


    
      dist_m = max(x for x in dist.flatten() if x < INF)
      ans = max(ans, dist_m)

print(ans)

      


    

### FIXED CODE ###

from collections import deque
import numpy as np

H,W = map(int,input().split())
maze = [input() for _ in range(H)]

ans = 0
for x in range(H):
    for y in range(W):
        #壁からはスタートできない
        if maze[x][y] == "#":
            continue

        #初期化
        distance = [[0]*W for _ in range(H)]
        #start位置
        stack = deque([[x,y]])

        while stack:
            h,w = stack.popleft()
            for i,j in [[1,0],[-1,0],[0,1],[0,-1]]:
                new_h, new_w = h+i, w+j
                if new_h < 0 or new_w < 0 or new_h >= H or new_w >= W:
                    continue
                elif maze[new_h][new_w] != "#" and distance[new_h][new_w] == 0:
                    distance[new_h][new_w] = distance[h][w]+1
                    stack.append([new_h, new_w])

        #start位置は0で初期化
        distance[x][y] = 0
        ans = max(ans, np.max(distance))

print(ans)
a, b = map(int, input().split())

c = 1
for i in range(20):
    if b > c:
        c += a-1
    else:
        break
print(-(-c // a-1))

### FIXED CODE ###

a,b,c = input()
d,e,f = input()
count = 0
if a == d:
    count+= 1
if b == e:
    count+= 1
if c == f:
    count+= 1
print(count)
n,t=map(int,input().split())
a=list(map(int,input().split()))
j=t
for i in range(1,n+1):
  if a[i]>t:
    j+=t
  else:
    j+=a[i]
    
print(j)

### FIXED CODE ###

n,t=map(int,input().split())
a=list(map(int,input().split()))
j=t
for i in range(1,n):
  if a[i]-a[i-1]>t:
    j+=t
  else:
    j+=a[i]-a[i-1]
    
print(j)
N = int(input())
A = [int(input()) for _ in range(N)]

dp = [0] * N
prev_i = [-1] * (N + 1)

dp[0] = 1
prev_i[A[0]] = 0

for i in range(1, N):
  a = A[i]
  if prev_i[a] != -1:
    if prev_i[a] != i - 1:
      dp[i] = dp[i - 1] + dp[prev_i[a]]
    else:
      dp[i] = dp[i - 1]
  else:
    dp[i] = dp[i - 1]
  prev_i[a] = i
  #print(i, dp, prev_i)

print(dp[-1])

### FIXED CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]

MOD = 10**9 + 7

dp = [0] * N
prev_i = [-1] * (2 * 10**5 + 1)

dp[0] = 1
prev_i[A[0]] = 0

for i in range(1, N):
  a = A[i]
  if prev_i[a] >= 0:
    if prev_i[a] == i - 1:
      dp[i] = dp[i - 1]
    else:
      dp[i] = dp[i - 1] + dp[prev_i[a]]
  else:
    dp[i] = dp[i - 1]
  prev_i[a] = i
  #print(i, dp, prev_i)

print(dp[-1] % MOD)
import math
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7



if (2 * Y - X) % 3 != 0:
	print(0)
elif (2 * X - Y) % 3 != 0:
	print(0)
else:
	a = (2 * Y - X) // 3
	b = (2 * X - Y) // 3
	print(a, b)
	factorial = [1]
	for i in range(1, a + b + 5):
		factorial.append(factorial[i-1] * i % MOD)
	# print(factsorial)
	print(int(factorial[a + b] // (factorial[a] * factorial[b])) % MOD)

### FIXED CODE ###

import math
X, Y = map(int, input().split())
MOD = 10 ** 9 + 7



if (2 * Y - X) % 3 != 0 or (2 * X - Y) % 3 != 0 or (2 * Y - X) // 3 < 0 or (2 * X - Y) // 3 < 0:
	print(0)
else:
	a = (2 * Y - X) // 3
	b = (2 * X - Y) // 3
	factorial = [1]
	inverse = [1]
	for i in range(1, a + b + 5):
		factorial.append(factorial[-1] * i % MOD)
		inverse.append(pow(factorial[-1], MOD - 2, MOD))
	print(factorial[a + b] * inverse[a] * inverse[b] % MOD)
a,b,c,d= map(int,input().split())

if a>=0 and b>=0 and c>=0 and d>=0:
    print(b*d)
elif a>=0 and b>=0 and c<=0 and d<=0:
    print(a*d)
elif a>=0 and b>=0 and c<=0 and d>=0:
    print(b*d)
elif a<=0 and b>=0 and c>=0 and d>=0:
    print(b*d)
elif a<=0 and b<=0 and c<=0 and d>=0:
    print(a*c)
elif a<=0 and b<=0 and c>=0 and d>=0:
    print(a*c)
elif a<=0 and b<=0 and c<=0 and d<=0:
    print(a*d)
elif a<=0 and b<=0 and c<=0 and d>=0:
    print(a*c)
elif a<=0 and b>=0 and c<=0 and d>=0:
    x=a*c
    y=b*d
    #print(x,y)
    if x>=y:
        print(x)
    else:
        print(y)

### FIXED CODE ###

x= int(input())

if x ==0:
    print(1)
else:
    print(0)
N, A, B = int(input()), int(input()), int(input())
data = []

def digitsum(n):
        s = str(n)
        array = list(map(int, s))
        return sum(array)

n = 0
for n in range(N+1):
        x = digitsum(n)
        if A <= x <= B:
                data.append(x)

print(sum(data))

### FIXED CODE ###

n, a, b = map(int, input().split())
ans = 0

for i in range(1, n+1):
    if a <= sum(map(int, list(str(i)))) <= b:
        ans += i
    else:
        continue

print(ans)
n = int(input())
lst = [int(x) for x in input().split()]
a = 0
for i in range(n):
    lst[i] = lst[i] - (i + 1)
lst.sort()
def sum(k):
    a = 0
    for i in range(n):
        a += abs(lst[i]-k)
    return a
ans = 0
if ans % 2 == 0:
    ans = min([sum(lst[int(n/2)]),sum(lst[int(n/2)+1])])
else:
    ans = sum(lst[int(n/2)+1])
print(str(ans))

### FIXED CODE ###

n = int(input())
lst = [int(x) for x in input().split()]
a = 0
for i in range(n):
    lst[i] = lst[i] - (i + 1)
lst.sort()
def sum(k):
    a = 0
    for i in range(n):
        a += abs(lst[i]-k)
    return a
ans = 0
if ans % 2 == 0:
    ans = min([sum(lst[int(n/2)-1]),sum(lst[int(n/2)])])
else:
    ans = sum(lst[int(n/2)])
print(str(ans))
MOD = 10**9+7
h, w = map(int, input().split())
a = [['#' for _ in range(w+2)]]
for _ in range(h):
	l = ['#']
	m = list(input())
	l += m
	l.append('#')
	a.append(l)
a.append(['#' for _ in range(w+2)])

dp1 = [[[False, False] for _ in range(w+2)] for _ in range(h+2)]

def dfs1(x, y):
	if a[x+1][y] == '.':
		dp1[x+1][y][0] = True
		dfs1(x+1, y)
	if a[x][y+1] == '.':
		dp1[x][y+1][1] = True
		dfs1(x, y+1)
	return

dp2 = [[0 for _ in range(w+2)] for _ in range(h+2)]
dp2[1][1] = 1
def dfs2(x, y):
	if dp1[x][y] == [False, False]:
		if a[x+1][y] == '.':
			dp2[x+1][y] += (dp2[x][y] % MOD)
			dp2[x+1][y] %= MOD
			dp1[x+1][y][0] = False
			dfs2(x+1, y)
		if a[x][y+1] == '.':
			dp2[x][y+1] += (dp2[x][y] % MOD)
			dp2[x][y+1] %= MOD
			dp1[x][y+1][1] = False
			dfs2(x, y+1)
	return

dfs1(1,1)
dfs2(1,1)
ans = dp2[h][w] % MOD
print(ans)

### FIXED CODE ###

MOD = 10**9+7
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
dp = [[0 for _ in range(w)] for _ in range(h)]
for i in range(h):
	for j in range(w):
		if (i == 0) & (j == 0):
			dp[i][j] = 1
		elif a[i][j] == '#':
			continue
		elif i == 0:
			dp[i][j] = dp[i][j-1]
		elif j == 0:
			dp[i][j] = dp[i-1][j]
		else:
			dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD
print(dp[h-1][w-1])
s=input()
print(s.split(,))

### FIXED CODE ###

s=input()
print(s.replace(","," "))
old_id=input()
new_id=input()

result = "Yes" if len(old_id)+1 == len(new_id) and old_id.index(new_id[0]) == 0 and old_id in new_id else "No"
print(result)

### FIXED CODE ###

old_id=input()
new_id=input()

try:
  result = "Yes" if len(old_id)+1 == len(new_id) and old_id.index(new_id[0]) == 0 and old_id in new_id else "No"
  print(result)
except ValueError:
  print("No")
n = long(input())
#n = 1000000
#a = []
sum = 0

for x in range(n):
	if x % 5 != 0 and x % 3 != 0:
		sum += x

print(long(sum))

### FIXED CODE ###

a = int(input())
#a = 118
l = [int(x) for x in list(str(a))]
flag = False

for x in l:
	if x == 7:
		flag = True

if flag == True:
	print("Yes")
else:
	print("No")
X = 3.14159265*2*R
print(X)

### FIXED CODE ###

R=int(input())
X=3.14159265*2*R
print(X)
from collections import deque
# N < 10^5, A, B, C < 10^9
# s = ('AB', 'AC', 'BC')
# A >= 0, B >= 0, C >= 0
# N回操作できるか？できるなら道筋を
# 各ステップで2通りのどちらかしか選択できない。
# DPだと思う
# (A, B, C, i)
que = deque()
def func(x, S):
    i = x[3]
    if x[3] == N:
        print('Yes')
        return 1
    if S[i] == 'AB':
        if x[1] > 0:
            result = func((x[0]+1, x[1]-1, x[2], x[3]+1), S)
            if result:
                que.append('A')
                return 1
        if x[0] > 0:
            result = func((x[0]-1, x[1]+1, x[2], x[3]+1), S)
            if result:
                que.append('B')
                return 1
    elif S[i] == 'BC':
        if x[2] > 0:
            result = func((x[0], x[1]+1, x[2]-1, x[3]+1), S)
            if result:
                que.append('B')
                return 1

        if x[1] > 0:
            result = func((x[0], x[1]-1, x[2]+1, x[3]+1), S)
            if result:
                que.append('C')
                return 1
    elif S[i] == 'AC':
        if x[2] > 0:
            result = func((x[0]+1, x[1], x[2]-1, x[3]+1), S)
            if result:
                que.append('A')
                return 1
        if x[0] > 0:
            result = func((x[0]-1, x[1], x[2]+1, x[3]+1), S)
            if result:
                que.append('C')
                return 1
    return 0


N, A, B, C = [int(i) for i in input().split()]
S = [input() for _ in range(N)]
i = 0

result = func((A, B, C, i), S)
if result == 1:
    while len(que) > 0:
        print(que.pop())
else:
    print('No')


### FIXED CODE ###

from collections import deque
import sys
sys.setrecursionlimit(500000)
# N < 10^5, A, B, C < 10^9
# s = ('AB', 'AC', 'BC')
# A >= 0, B >= 0, C >= 0
# N回操作できるか？できるなら道筋を
# 各ステップで2通りのどちらかしか選択できない。
# DPだと思う
# (A, B, C, i, '')

def f(x, dic):
    if x[4] == '':
        return 1
    else:
        if f(dic[x], dic):
            print(x[4])
            return 1

N, A, B, C = [int(i) for i in input().split()]
S = [input() for _ in range(N)]
i = 0
dic = {}
que = deque([(A, B, C, i, '')])
while len(que) != 0:
    x = que.pop()
    i = x[3]
    if x[3] == N:
        print('Yes')
        f(x, dic)
        exit()
    if S[i] == 'AB':
        if x[1] > 0:
            newx = (x[0]+1, x[1]-1, x[2], x[3]+1, 'A')
            dic[newx] = x
            que.append(newx)
        if x[0] > 0:
            newx = (x[0]-1, x[1]+1, x[2], x[3]+1, 'B')
            dic[newx] = x
            que.append(newx)
    elif S[i] == 'BC':
        if x[2] > 0:
            newx = (x[0], x[1]+1, x[2]-1, x[3]+1, 'B')
            dic[newx] = x
            que.append(newx)
        if x[1] > 0:
            newx = (x[0], x[1]-1, x[2]+1, x[3]+1, 'C')
            dic[newx] = x
            que.append(newx)
    elif S[i] == 'AC':
        if x[2] > 0:
            newx = (x[0]+1, x[1], x[2]-1, x[3]+1, 'A')
            dic[newx] = x
            que.append(newx)
        if x[0] > 0:
            newx = (x[0]-1, x[1], x[2]+1, x[3]+1, 'C')
            dic[newx] = x
            que.append(newx)
    else:
        print('error')
print('No')
n = int(input())
s, t = input().split()

for i in range (n):
  a.append(s[n])
  a.append(t[n])
  
print(n)

### FIXED CODE ###

n = int(input())
A, B = input().split()
c = ""

for i in range(n):
  c = c+A[i]
  c = c+B[i]

print(c)
#d
m,n=map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
maze = []
inf = 9999999
dist = [inf]* n
dist[0] = 0
queue = []
answer = [0]*n

goto = [[] * 1 for i in range(n)]
for i in range(len(ab)):
    goto[ab[i][0]-1].append(ab[i][1]-1)
    goto[ab[i][1]-1].append(ab[i][0]-1)

queue.extend([0])

while queue != []:
    go = queue.pop()
    for h in goto[go]:
        if dist[h] == inf:
            queue.append(h)
            dist[h] = dist[go]+1
            answer[h] =go+1
print("Yes")
for i in answer[1:]:
    print(i)

### FIXED CODE ###

#d
n,m=map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
maze = []
inf = 9999999
dist = [inf]* n
dist[0] = 0
queue = []
answer = [0]*n

goto = [[] * 1 for i in range(n)]
for i in range(len(ab)):
    goto[ab[i][0]-1].append(ab[i][1]-1)
    goto[ab[i][1]-1].append(ab[i][0]-1)

queue.extend([0])

while queue != []:
    go = queue.pop(0)
    for h in goto[go]:
        if dist[h] == inf:
            queue.append(h)
            dist[h] = dist[go]+1
            answer[h] =go+1
            

            
print("Yes")
for i in answer[1:]:
    print(i)
from datetime import date

M1=
M2=
D1=
D2=

dt1 = date(2019,M1,D1)
dt2 = date(2019,M2,D2)

d = dt2 - dt1
d = d.days

if d != 1:
    print(0)
else:
    if M1 == 1 and D1 == 31:
        print(1)
    elif M1 == 2 and D1 == 28:
        print(1)
    elif M1 == 3 and D1 == 31:
        print(1)
    elif M1 == 4 and D1 == 30:
        print(1)
    elif M1 == 5 and D1 == 31:
        print(1)
    elif M1 == 6 and D1 == 30:
        print(1)
    elif M1 == 7 and D1 == 31:
        print(1)
    elif M1 == 8 and D1 == 31:
        print(1)
    elif M1 == 9 and D1 == 30:
        print(1)
    elif M1 == 10 and D1 == 31:
        print(1)
    elif M1 == 11 and D1 == 30:
        print(1)
    elif M1 == 12 and D1 == 31:
        print(1)
    else:
        print(0)

### FIXED CODE ###

from datetime import date

M1,D1=map(int, input().split())
M2,D2=map(int, input().split())

dt1 = date(2019,M1,D1)
dt2 = date(2019,M2,D2)

d = dt2 - dt1
d = d.days

if d != 1:
    print(0)
else:
    if M1 == 1 and D1 == 31:
        print(1)
    elif M1 == 2 and D1 == 28:
        print(1)
    elif M1 == 3 and D1 == 31:
        print(1)
    elif M1 == 4 and D1 == 30:
        print(1)
    elif M1 == 5 and D1 == 31:
        print(1)
    elif M1 == 6 and D1 == 30:
        print(1)
    elif M1 == 7 and D1 == 31:
        print(1)
    elif M1 == 8 and D1 == 31:
        print(1)
    elif M1 == 9 and D1 == 30:
        print(1)
    elif M1 == 10 and D1 == 31:
        print(1)
    elif M1 == 11 and D1 == 30:
        print(1)
    elif M1 == 12 and D1 == 31:
        print(1)
    else:
        print(0)