Harryxun/stf_run huggingface dataset:
N = int(input())
Lifes = map(int, input().split())

Lifes.sort(key=lambda x:-x)

ans = Lifes[N-1]

for i in range(N):
  for j in range(i, N):
    life = Lifes[i] - Lifes[j]
    if life > 0:
      ans = min(ans, life)
print(ans)


### FIXED CODE ###

N = int(input())
Lifes = list(map(int, input().split()))

Lifes.sort(key=lambda x:-x)

ans = Lifes[N-1]

# for i in range(N):
#   for j in range(i, N):
#     life = Lifes[i]%Lifes[j]
#     if life > 0:
#       ans = min(ans, life)
# print(ans)

update = True
while update:
    min_num = ans
    for i in range(N):
        life_mod = Lifes[i]%ans
        if life_mod > 0:
            Lifes[i] = life_mod
            if min_num > life_mod:
                min_num = life_mod
    if ans == min_num:
        update=False
    else:
        ans = min_num
print(ans)
list = input().split()
a = list[0]
b = list[1]
c = list[2]
d = list[3]
result = 0
if a < b and c < d:
    if (a >= c and b <= d) or (a <= c and b >= d):
        result = min(b-a,d-c)
    elif a <= c and c <= b:
        result = b - c
    elif c <= a and a <= d:
        result =  d - a
print(result)

### FIXED CODE ###

list = input().split()
a = int(list[0])
b = int(list[1])
c = int(list[2])
d = int(list[3])
result = 0
if a < b and c < d:
    if (a >= c and b <= d) or (a <= c and b >= d):
        result = min(b-a,d-c)
    elif a <= c and c <= b:
        result = b - c
    elif c <= a and a <= d:
        result =  d - a
print(result)
input random for random
n = int(input())
x = randint(1,n)
if n % 2 ==0:
  print(0.5)
else:
  count = (1+n)*n*0.5
  counts = count//2
  print(counts/count)

### FIXED CODE ###

import random
n = int(input())
x = random.randint(1,n)
if n % 2 ==0:
  print(0.5)
else:
  count = n//2
  print((n-count)/n)
S = input()
N = len(S)
DP =[0]*13
DP[0] = 1
A = 0
MOD = 10**9+7

B = [[0]*13 for i in range(13)]
for i in range(13):
    for j in range(13):
        B[i][j] = (i*j)%13
T = [1,10,9,12,3,4]
A = 0
for i in range(N):
    A*=10
    if S[i] == "?":
        hoge = [0]*13
        for j in range(13):
            for k in range(10):
                hoge[(j+k*T[(N-i-1)%6])%13] = (hoge[(j+k*T[(N-i-1)%6])%13] + DP[j])%MOD
        DP = hoge.copy()
    else:
        A = (A+int(S[i]))%13
print(DP[(A+5)%13])

### FIXED CODE ###

S = input()
N = len(S)
DP =[0]*13
DP[0] = 1
A = 0
MOD = 10**9+7

T = [1,10,9,12,3,4]
A = 0
for i in range(N):
    A*=10
    if S[i] == "?":
        hoge = [0]*13
        for j in range(13):
            for k in range(10):
                hoge[(j+k*T[(N-i-1)%6])%13] = (hoge[(j+k*T[(N-i-1)%6])%13] + DP[j])%MOD
        DP = hoge[:]
    else:
        A += int(S[i])
    A = A%13
print(DP[(5-A)%13])
import bisect
from itertools import permutations
A, B, Q = map(int, input().split())
S = []
for _ in range(A):
    S.append(int(input()))
T = []
for _ in range(B):
    T.append(int(input()))

for _ in range(Q):
    x = int(input())
    sr = bisect.bisect_right(S, x)
    tr = bisect.bisect_right(T, x)
    c = []
    if sr == A:
        c.append([S[A-1], 0])
    elif sr == 0:
        c.append([S[sr], 0])
    else:
        c.append([S[sr], 0])
        c.append([S[sr-1], 0])
    if tr == B:
        c.append([T[B-1], 1])
    elif tr == 0:
        c.append([T[tr], 1])
    else:
        c.append([T[tr], 1])
        c.append([T[tl-1], 1])
    ans = 10**16
    for elem in permutations(c):
        tmp = 0
        flag = [False, False]
        now_pos = x
        flag_calc = True
        for pos, kind in elem:
            if flag[kind]:
                flag_calc = False
                break
            tmp += abs(pos-now_pos)
            now_pos = pos
            flag[kind] = True
            if flag[0] and flag[1]:
                break
        if flag_calc:
            ans = min(ans, tmp)
    print(ans)


### FIXED CODE ###

import bisect
A, B, Q = map(int, input().split())
S = []
for _ in range(A):
    S.append(int(input()))
T = []
for _ in range(B):
    T.append(int(input()))

for _ in range(Q):
    x = int(input())
    sr = bisect.bisect_right(S, x)
    tr = bisect.bisect_right(T, x)
    tmpS = []
    tmpT = []
    if sr == A:
        tmpS.append(S[A-1])
    elif sr == 0:
        tmpS.append(S[sr])
    else:
        tmpS.append(S[sr])
        tmpS.append(S[sr-1])
    if tr == B:
        tmpT.append(T[B-1])
    elif tr == 0:
        tmpT.append(T[tr])
    else:
        tmpT.append(T[tr])
        tmpT.append(T[tr-1])
    ans = 10**16
    for s in tmpS:
        tmp = abs(x-s)
        tmp1 = 10**16
        for elemT in tmpT:
            tmp1 = min(tmp1, abs(elemT-s))
        ans = min(ans, tmp+tmp1)
    for t in tmpT:
        tmp = abs(x-t)
        tmp1 = 10**16
        for elemS in tmpS:
            tmp1 = min(tmp1, abs(elemS-t))
        ans = min(ans, tmp+tmp1)
    print(ans)
N, M = map(int, input().split())

C = []
S = []

for i in range(M):
    c, s = map(int, input().split())
    C.append(c)
    S.append(s)

for x in range(1000):
    keta = 1
    nx = x//10
    d = [x%10]


    while(nx):
        keta += 1
        d.append(nx%10)
        nx = nx // 10
    d = list(reversed(d))

    isOk = True
    
    for i in range(M):
        if( d[C[i]-1] != S[i-1] ):
            isOk = False

    if isOk :
        num = "".join(map(str, d))
        print(num)
        return 0

print(-1)
return 0

### FIXED CODE ###

N, M = map(int, input().split())

ans = [0 for i in range(N)]
isTerms = [0 for i in range(N)]
jadge = True

for i in range(M):
    s, c = map(int, input().split())
    if( ans[s-1] != c and isTerms[s-1] != 0):
        jadge = False
    elif( s == 1 and c == 0):
        jadge = False
    else:
        ans[s-1] = c
        isTerms[s-1] = 1

if( N != 1 and ans[0] == 0 and jadge):
    ans[0] = 1

if( N == 1 and ans[0] == 0):
    jadge = True

if jadge:
    if(N==1):
        print(ans[0])
    else:
        for i in range(N-1):
            print(ans[i] ,end = "")
        print(ans[i+1])
else:
    print(-1)
#pypyは内包表記使わない
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    A, B, C, D, E, F = map(int, input().split())
    rate = 0
    for i in range(30//A+1):
        for j in range(30//B+1):
            if i==0 and j==0:
                continue
            water = A*i + B*j
            if water*100 > F:
                continue
            limit = water * E
            for s in range(limit//C+1):
                sugar = limit - (limit-C*s)%D
                if water*100 + sugar > F:
                    continue
                if rate < sugar/(sugar+water*100):
                    rate = sugar/(sugar+water*100)
                    res_water = water * 100
                    res_sugar = sugar
    print(res_water+res_sugar, res_sugar)

if __name__ == '__main__':
    main()

### FIXED CODE ###

A,B,C,D,E,F = map(int,input().split())
f = F//100

ans = [0,0]
per = -1
#水の量を100g単位ずつ全探索
for w in range(1,f+1):
    #そのような水の取り方があるか確認
    wt = 0
    for b in range(0,w+1,B):
        if (w-b)%A == 0:
            wt = 1
            break
    if wt == 0:
        continue

    water = w*100
    sugar = min(w*E,F-water)
    if ans[0] == 0:
        ans[0] = water
    st = 0
    #砂糖として考えられる量を大きい順に0gまでに全探索
    for s in range(sugar,0,-1):
        st = 0
        for d in range(0,s+1,D):
            if (s-d)%C == 0:
                st = 1
                break
        if st == 1:
            break
    if st == 1 and s+water <= F and s/(s+water) > per:
        ans = [s+water,s]
        per = s/(s+water)

print(' '.join(map(str,ans)))
N, A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
l = [int(stdin.readline().rstrip()) for _ in range(N)]


def solve(m, a, b, c):
    if m == N:
        if a == 0 or b == 0 or c == 0:
            return 10 ** 7
        else:
            return abs(a - A) + abs(b - B) + abs(c - C) - 30
    return min(solve(m + 1, a, b, c), solve(m + 1, a + l[m], b, c) + 10,
               solve(m + 1, a, b + l[m], c) + 10, solve(m + 1, a, b, c + l[m]) + 10)


print(solve(0, 0, 0, 0))

### FIXED CODE ###

from sys import stdin

# ABC
# N = int(stdin.readline().rstrip())


def dfs(x):
    ret = 0
    if int(x) > N:
        return ret
    if '7' in x and '5' in x and '3' in x:
        ret += 1
    for k in '753':
        ret += dfs(x + k)
    return ret


# print(dfs('0'))

# ABC119 C - Synthetic Kadomatsu
N, A, B, C = [int(x) for x in stdin.readline().rstrip().split()]
l = [int(stdin.readline().rstrip()) for _ in range(N)]


def solve(m, a, b, c):
    if m == N:
        if a == 0 or b == 0 or c == 0:
            return 10 ** 7
        else:
            return abs(a - A) + abs(b - B) + abs(c - C) - 30
    return min(solve(m + 1, a, b, c), solve(m + 1, a + l[m], b, c) + 10,
               solve(m + 1, a, b + l[m], c) + 10, solve(m + 1, a, b, c + l[m]) + 10)


print(solve(0, 0, 0, 0))
n = int(input())
a = input().split()
 
money = 1000
stock = 0
pivot = []
flag = 0
 
for i in range(n):
    pivot.append(int(a[i+1]) - int(a[i]))
 
pivot.append(-1)
pivot.append(-1)
 
i=0
 
for j in range(n):
    if(pivot[j]>0):
        i = j
        break
    else:
        flag = -1
 
if(flag != -1):
    stock = int(money//(int(a[i])))
    money = int(money%(int(a[i])))
 
i+=1
if(flag != -1):
    while(i<n):
        if(i==n-1):
            if(pivot[i]>0):
                money = money + stock*int(a[i+1])
                stock = 0
            break
 
        elif(pivot[i]<0):
            while(pivot[i+1]<=0 and flag != -1):
                if(i==n-2):
                    flag = -1
                i+=1
            if(flag != -1):
                stock = int(money//(int(a[i+1])))
                money = int(money%(int(a[i+1])))
                i+=1
        else:
            while(pivot[i+1]>=0 and flag != -1):
                if(i==n-2):
                    flag = -1
                i+=1
            money = money + stock*int(a[i+1])
            stock = 0
            i+=1
 
print(money)

### FIXED CODE ###

n = int(input())
a = input().split()

money = 1000
stock = 0
pivot = []
upflag = 0
dnflag = 1

if(int(a[1]) - int(a[0]) > 0): # initial
    stock = int(money // (int(a[0])))
    money = int(money % (int(a[0])))
    upflag = 1
    dnflag = 0

for i in range(n-2): # i=0,1,,,,n-3 (for n=7, n-3=4)
    if(int(a[i+1]) == int(a[i])):
        if((int(a[i+2]) - int(a[i+1]) < 0) and upflag == 1): # i+1 is local max so that to sell stock
            money = money + stock * (int(a[i+1]))
            stock = 0
            upflag = 1
            dnflag = 0
        elif((int(a[i+2]) - int(a[i+1]) > 0) and dnflag == 1): # i+1 is local min so that to sell stock
            stock = int(money // (int(a[i+1])))
            money = int(money % (int(a[i+1])))
            upflag = 0
            dnflag = 1

    elif(int(a[i+1]) - int(a[i]) > 0):
        upflag = 1
        if(int(a[i+2]) - int(a[i+1]) < 0): # i+1 is local max so that to sell stock
            money = money + stock * (int(a[i+1]))
            stock = 0
            upflag = 0

    elif(int(a[i+1]) - int(a[i]) < 0):
        dnflag = 1
        if(int(a[i+2]) - int(a[i+1]) > 0): # i+1 is local min so that to buy stock
            stock = int(money // (int(a[i+1])))
            money = int(money % (int(a[i+1])))
            dnflag = 0

if(int(a[n-1]) - int(a[n-2]) > 0): # sell @ final
    money = money + stock * (int(a[n-1]))
elif(int(a[n-1]) - int(a[n-2]) == 0):
    if(upflag == 1):
        money = money + stock * (int(a[n-1]))

print(money)
S = map(str,input().split())
N = int(len(S))
S_a = S[:(N-1)//2]
S_b = S[(N+1)//2:]

if S == S[::-1] and S_a == S_a[::-1] and S_b == S_b[::-1]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S = input()
N = int(len(S))
S_a = S[:(N-1)//2]
S_b = S[(N+1)//2:]
#print(S)
if S == S[::-1] and S_a == S_a[::-1] and S_b == S_b[::-1]:
    print("Yes")
else:
    print("No")
A,B,C,K = map(int,input().split())

ans = 0
if K-A>0:
    ans += A*1
    K -= A
    judge = 1
elif K-A==0:
    #ここで終わり
    ans += A*1
    judge = 0



judgeB=1
if judge==1 and K-B>0:
    K -= B
    
elif judge==1 and K-B<=0:
    K-=B
    judgeB = 0
    


if judgeB==1:
    ans += -1*K

print(ans)

### FIXED CODE ###

A,B,C,K = map(float,input().split())
 
a = min(A, K)
if K-A>=0:
    b = min(abs(K-A), B)
else:
    b = 0
    c = 0

if K-A-B>=0:
    c = min(abs(K-A-B), C)
else:
    c = 0

ans = 1*a + 0*b - 1*c

print(int(ans))
N, X = list(int, input().split()[:2])
L = map(int, input().split())
D = 0
count = 0
for l in L:
  if D <= X:
      count += 1
  D += l
print(count)

### FIXED CODE ###

N, X = map(int, input().split())
L = map(int, input().split())
D = 0
count = 1
for i, l in enumerate(L):
  D += l
  if D <= X:
      count += 1
print(count)
import itertools　#pythonで累積和を使うときはitertoolsというライブラリのaccumulateを使う
n, k = map(int, input().split())
p = list(map(int, input().split()))
acc = list(itertools.accumulate([x for x in p])) #累積和の計算


#pの中から隣り合う（ｋ個）の和が最大のときの値は？（今回は２＋４＋５＝１１）　ｋ個離れたaccの差が最大なところ
ans=max(acc[i]-acc[i-k] for i in range(k-1,n))
answer=ans/2+k/2


### FIXED CODE ###

import itertools
 
n, k = map(int, input().split())
p = list(map(int, input().split()))
acc = [0] + list(itertools.accumulate([(x+1)/2 for x in p])) # 累積和を計算
 
ans = max(acc[i]-acc[i-k] for i in range(k, n+1)) # k番目からn番目まで計算
print(ans)
import sys
from math import factorial

def cal2(n, i):
    return int(factorial(n)/factorial(i)/factorial(n-i))
    
def cal1(num):
    total = 1
    if num < 1: return total
    if num == 1: return 2
    i = num
    for n in range(1, num):
        if n > i: return total
        total += cal2(i, n)
        i -= 1

def main():
    N, M = map(int, input().split())
    len_list = []
    pre_a = -1
    for m in range(M):
        a = int(input())
        if (pre_a + 1) == a: sys.exit("0")
        len_list.append(a-(pre_a+3))
        pre_a = a
    len_list.append(N-(pre_a+2))
    ans = 1
    for num in len_list:
        ans *= cal1(num)
    print(ans%1000000007)
    
main()

### FIXED CODE ###

def run():
  N, M = map(int, input().split())
  stairs = [1] * (N+1)
  for m in range(M):
    a = int(input())
    stairs[a] = 0
  #print(stairs)
  for n in range(2, N+1):
    stairs[n] = (stairs[n-1] + stairs[n-2])*stairs[n]
  print(stairs[N]%1000000007)
  
if __name__ == '__main__':
  run()
print(s)


### FIXED CODE ###

s = raw_input().split()
a = int(s[0])
b = int(s[1])
print("{0} {1}".format(a*b, 2*(a+b)))
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = int(input())
v = list(map(int, input().split()))
a = defaultdict(int)
b = defaultdict(int)

nn = n // 2
for i in range(nn):
    a[v[i * 2]] += 1
    b[v[i * 2 + 1]] += 1

ma1 = max(a, key=a.get)
mb1 = max(b, key=b.get)
mva1 = a[ma1]
mvb1 = b[mb1]
a[ma1] = 0
b[mb1] = 0
ma2 = max(a, key=a.get)
mb2 = max(b, key=b.get)
mva2 = a[ma2]
mvb2 = b[mb2]
a[ma2] = 0
b[mb2] = 0

ma = [(ma1, mva1), (ma2, mva2)]
mb = [(mb1, mvb1), (mb2, mvb2)]
mx = 0xFFFFFFFF
for i in ma:
    for j in mb:
        if i[0] == j[0]:
            pass
        else:
            mx = min(sum(a.values()) + i[1] + sum(b.values()) + j[1], mx)
if mx == 0xFFFFFFFF:
    print(0)
else:
    print(mx

### FIXED CODE ###

# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = int(input())
a = list(map(int, input().split()))
even = defaultdict(int)
odd = defaultdict(int)
for i in range(n):
    if i % 2 == 0:
        even[a[i]] += 1
    else:
        odd[a[i]] += 1
x = sorted(even.items(), reverse=True, key=lambda t:t[1])
y = sorted(odd.items(), reverse=True, key=lambda t:t[1])
even_index = 0
odd_index = 0
if x[0][0] == y[0][0]:
    if x[0][1] > y[0][1]:
        even_index = 0
        odd_index = 1
    elif x[0][1] < y[0][1]:
        odd_index = 0
        even_index = 1
    else:
        if len(x) > 1:
            print(n - x[0][1] - max(x[1][1], y[1][1]))
        else:
            print(n // 2)
        exit()
            
else:
    even_index = 0
    odd_index = 0
print(n - x[even_index][1] - y[odd_index][1])
s=raw_input()
s=s.split(' ')
maisuu = int(s[0])
maney  = int(s[1])

minn_man = int(maney/10000)+1
minn_sen = int(maney / 1000 )+1
minn_go  = int(maney / 5000) +1
flg=True
for man in range(0,minn_man):
	for go in range(0,minn_go):
		for sen in range(0,minn_sen):
			if man+go+sen == maisuu:
				if man*10000+ go*5000 + sen*1000 == maney:
					print(str(man)+","+str(go)+","+str(sen))
					flg=False
		if flg!=True:
			break
	if flg!=True:
		break
if flg:
	print('-1,-1,-1')


### FIXED CODE ###

s=input()

data = s.split('/')
out = '2018/01/'+data[2]

print(out)
H1, M1, H2, M2, K = map(int, input().split())

if h1 > h2:
    h2 += 24

h1 = H1 * 60
m1 = M1
h2 = H2 * 60
m2 = M2

print((h2 - m2) - (h1 + m1) - K)

### FIXED CODE ###

H1, M1, H2, M2, K = map(int, input().split())

h1 = H1 * 60
m1 = M1
h2 = H2 * 60
m2 = M2

ans = (h2 + m2) - (h1 + m1) - K if (h2 + m2) > (h1 + m1) else (h2 + m2) - (h1 + m1) - K + 24 * 60

print(ans)
# コンテスト名の要求
S =　input()
 
# 入力されたコンテストではないものを出力
if S == "ABC":
    print("ARC")
elif S == "ARC":
    print("ABC")
else:
    print("入力内容が正しくありません。")

### FIXED CODE ###

# コンテスト名の要求
S = input()

# 入力されたコンテストではないものを出力
if S == "ABC":
    print("ARC")
elif S == "ARC":
    print("ABC")
else:
    print("入力内容が正しくありません。")
import sys
from fractions import gcd
from collections import defaultdict
from collections import deque
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n, m = LI()
    g = [set() for i in range(n+1)]
    new_g = [set() for i in range(n+1)]
    new_gg = [set() for i in range(n+1)]
    for i in range(m):
        u, v = LI()
        g[u].add(v)
    s, t = LI()
    for i in range(n+1):
        new = set()
        for j in g[i]:
            new = new | g[j]
        new_g[i] = new_g[i] | new

    for i in range(n+1):
        new = set()
        for j in new_g[i]:
            new = new | g[j]
        new_gg[i] = new_gg[i] | new

    Q = deque([s])
    searched = [0 for i in range(n+1)]
    searched[s] = 1
    depth = [0 for i in range(n+1)]
    while len(Q) != 0:
        v = Q.popleft()
        for i in last[v]:
            if i == t:
                depth[i] = depth[v] + 1
                print(depth[i])
                return
            if searched[i] == 0:
                depth[i] = depth[v] + 1
                Q.append(i)
                searched[i] = 1
    print(-1)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
from fractions import gcd
from collections import defaultdict
from collections import deque
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n, m = LI()
    g = [[] for i in range(3*(n+1))]
    for i in range(m):
        u, v = LI()
        g[u].append(v + n + 1)
        g[u + n + 1].append(v + 2*(n + 1))
        g[u + 2*(n + 1)].append(v)

    s, t = LI()

    Q = deque([s])
    searched = [0 for i in range(3*(n+1))]
    searched[s] = 1
    depth = [0 for i in range(3*(n+1))]
    while len(Q) != 0:
        v = Q.popleft()
        for i in g[v]:
            if i == t:
                depth[i] = depth[v] + 1
                print(depth[i]//3)
                return
            if searched[i] == 0:
                depth[i] = depth[v] + 1
                Q.append(i)
                searched[i] = 1
    print(-1)


if __name__ == "__main__":
    main()
# -*- coding: utf-8 -*-
a = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

N = a[0]
M = a[1]
K = a[2]

count = 0 #読んだ冊数を記録
count_time = 0 #読んだ時間を記録
a = [0]
b = [0]

for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break 
    while b[j] < K - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)
 


### FIXED CODE ###

# -*- coding: utf-8 -*-
a = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

N = a[0]
M = a[1]
K = a[2]

count = 0 #読んだ冊数を記録
count_time = 0 #読んだ時間を記録
a = [0]
b = [0]

for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break 
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)
n = int(input())
out_count = 0
score = 0
runners = [0, 0, 0]

while n:
    event = input()
    if event == "HIT":
        if runners.pop():
            score+=1
        runners = [1] + runners
    if event == "HOMERUN":
        score += 1 + sum(runners)
        runners = [0, 0, 0]
                
    if event == "OUT":
        out_count += 1
        if out_count > 2:
            print(score)
            score = 0
            out_count = 0
            runners = [0, 0, 0]
        

### FIXED CODE ###

n = int(input())
out_count = 0
score = 0
runners = [0, 0, 0]

while n:
    event = input()
    if event == "HIT":
        if runners.pop():
            score+=1
        runners = [1] + runners
    if event == "HOMERUN":
        score += 1 + sum(runners)
        runners = [0, 0, 0]
                
    if event == "OUT":
        out_count += 1
        if out_count > 2:
            n-=1
            print(score)
            score = 0
            out_count = 0
            runners = [0, 0, 0]
A,B,C=map(int,input().split())
D,E,F=map(int,input().split())
G,H,I=map(int,input().split())
N=int(input())
b=[input() for i in range(N+1)]
if b.count(A)>0 and b.count(B)>0 and b.count(C)>0:
    print("Yes")
    exit()
if b.count(D)>0 and b.count(E)>0 and b.count(F)>0:
    print("Yes")
    exit()
if b.count(G)>0 and b.count(H)>0 and b.count(I)>0:
    print("Yes")
    exit()
if b.count(A)>0 and b.count(D)>0 and b.count(G)>0:
    print("Yes")
    exit()
if b.count(B)>0 and b.count(E)>0 and b.count(H)>0:
    print("Yes")
    exit()
if b.count(C)>0 and b.count(F)>0 and b.count(I)>0:
    print("Yes")
    exit()
if b.count(A)>0 and b.count(E)>0 and b.count(I)>0:
    print("Yes")
    exit()
if b.count(C)>0 and b.count(E)>0 and b.count(G)>0:
    print("Yes")
    exit()
else:
    print("No")

    




### FIXED CODE ###

l=[list(map(int,input().split())) for i in range(3)]
N=int(input())
b=[int(input()) for i in range(N)]
if b.count(l[0][0])>0 and b.count(l[0][1])>0 and b.count(l[0][2])>0:
    print("Yes")
    exit()
if b.count(l[1][0])>0 and b.count(l[1][1])>0 and b.count(l[1][2])>0:
    print("Yes")
    exit()
if b.count(l[2][0])>0 and b.count(l[2][1])>0 and b.count(l[2][2])>0:
    print("Yes")
    exit()
if b.count(l[0][0])>0 and b.count(l[1][0])>0 and b.count(l[2][0])>0:
    print("Yes")
    exit()
if b.count(l[0][1])>0 and b.count(l[1][1])>0 and b.count(l[2][1])>0:
    print("Yes")
    exit()
if b.count(l[0][2])>0 and b.count(l[1][2])>0 and b.count(l[2][2])>0:
    print("Yes")
    exit()
if b.count(l[0][0])>0 and b.count(l[1][1])>0 and b.count(l[2][2])>0:
    print("Yes")
    exit()
if b.count(l[0][2])>0 and b.count(l[1][1])>0 and b.count(l[2][0])>0:
    print("Yes")
    exit()
else:
    print("No")