Problem:


Score : 200 points

Problem Statement

We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.

The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.

Determine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.

Constraints

All values in input are integers.

1 \leq A_{i, j} \leq 100

A_{i_1, j_1} \neq A_{i_2, j_2} ((i_1, j_1) \neq (i_2, j_2))

1 \leq N \leq 10

1 \leq b_i \leq 100

b_i \neq b_j (i \neq j)

Input

Input is given from Standard Input in the following format:

A_{1, 1} A_{1, 2} A_{1, 3}
A_{2, 1} A_{2, 2} A_{2, 3}
A_{3, 1} A_{3, 2} A_{3, 3}
N
b_1
\vdots
b_N

Output

If we will have a bingo, print Yes; otherwise, print No.

Sample Input 1

84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30

Sample Output 1

Yes

We will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.

Sample Input 2

41 7 46
26 89 2
78 92 8
5
6
45
16
57
17

Sample Output 2

No

We will mark nothing.

Sample Input 3

60 88 34
92 41 43
65 73 48
10
60
43
88
11
48
73
65
41
92
34

Sample Output 3

Yes

We will mark all the squares.



Sample input:
84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30


Sample output:
Yes

Submission status: Runtime Error

Solution code:
B=[];bingo=0
import numpy as np
A=np.zeros((3,3),dtype=int)
for i in range(3):
  a,b,c=map(int,input().split())
  A[i][0]=a
  A[i][1]=b
  A[i][2]=c
N=int(input())
for i in range(N):
  B.append(int(input()))
#print(A)
#print(B)
for i in range(3):
  for j in range(3):
    for k in range(N):
      if A[i][j]==B[k]:
        A[i][j]=0
#print(A)
for i in range(3):
  if sum(A[i][:])==0:
    bingo=bingo+1
for i in range(3):
  if sum(A[0][i])==0 or sum(A[1][i])==0 or sum(A[2][i])==0:
    bingo=bingo+1
if A[0][0]+A[1][1]+A[2][2]==0:
  bingo=bingo+1
if A[2][0]+A[1][1]+A[0][2]==0:
  bingo=bingo+1
print("Yes" if bingo>=1 else "No")
print(sum(A[:][1]))
print(sum(A[1][:]))
print(bingo)

Submission status: Runtime Error

Solution code:
N = int(input())
for k in range(N):
    B = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == B:
                A[i][j] = 0
 
ok = False
for i in range(3):
    if A[i][0] == A[i][1] and A[i][1] == A[i][2]:
        ok = True
    if A[0][i] == A[1][i] and A[1][i] == A[2][i]:
        ok = True
if A[0][0] == A[1][1] and A[1][1] == A[2][2]:
    ok = True
if A[2][0] == A[1][1] and A[1][1] == A[0][2]:
    ok = True
print('Yes' if ok else 'No')

Submission status: Runtime Error

Solution code:
#bingo
a1=[int(i) for i in input().split()]
a2=[int(i) for i in input().split()]
a3=[int(i) for i in input().split()]
a=[a1,a2,a3]
n=int(input())
b=[]
for j in range(n):
    B=int(input())
    b.append(B)

hc1=[]
hc2=[]
hc3=[]

for i in b:
    for j in a1:
        if i==j:
            hc1.append("hit")
    for j in a2:
        if i==j:
            hc2.append("hit")     
    for j in a3:
        if i==j:
            hc3.append("hit")

#よこ
if hc1[0]=="hit" and hc1[1]=="hit" and hc1[2]=="hit":
    print("Yes")
elif hc2[0]=="hit" and hc2[1]=="hit" and hc2[2]=="hit":
    print("Yes")
elif hc3[0]=="hit" and hc3[1]=="hit" and hc3[2]=="hit":
    print("Yes")
#たて
elif hc1[0]=="hit" and hc2[0]=="hit" and hc3[0]=="hit":
    print("Yes")
elif hc1[1]=="hit" and hc2[1]=="hit" and hc3[1]=="hit":
    print("Yes")
elif hc1[2]=="hit" and hc2[2]=="hit" and hc3[2]=="hit":
    print("Yes")
#斜め
elif hc1[0]=="hit" and hc2[1]=="hit" and hc3[2]=="hit":
    print("Yes")
elif hc1[2]=="hit" and hc2[1]=="hit" and hc3[0]=="hit":
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
#bingo
a1=[int(i) for i in input().split()]
a2=[int(i) for i in input().split()]
a3=[int(i) for i in input().split()]
a=[a1,a2,a3]
n=int(input())
b=[]
for j in range(n):
    B=int(input())
    b.append(B)

hc1=[]
hc2=[]
hc3=[]

for i in b:
    for j in a1:
        if i==j:
            hc1.append("hit")
    for j in a2:
        if i==j:
            hc2.append("hit")     
    for j in a3:
        if i==j:
            hc3.append("hit")

#よこ
if hc1[0]=="hit" and hc1[1]=="hit" and hc1[2]=="hit"
    print("Yes")
elif hc2[0]=="hit" and hc2[1]=="hit" and hc2[2]=="hit"
    print("Yes")
elif hc3[0]=="hit" and hc3[1]=="hit" and hc3[2]=="hit"
    print("Yes")
#たて
elif hc1[0]=="hit" and hc2[0]=="hit" and hc3[0]=="hit"
    print("Yes")
elif hc1[1]=="hit" and hc2[1]=="hit" and hc3[1]=="hit"
    print("Yes")
elif hc1[2]=="hit" and hc2[2]=="hit" and hc3[2]=="hit"
    print("Yes")
#斜め
    elif hc1[0]=="hit" and hc2[1]=="hit" and hc3[2]=="hit"
    print("Yes")
    elif hc1[2]=="hit" and hc2[1]=="hit" and hc3[0]=="hit"
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
    b.append(B)

Submission status: Runtime Error

Solution code:
#bingo
a1=[int(i) for i in input().split()]
a2=[int(i) for i in input().split()]
a3=[int(i) for i in inpiut().split()]
a=[a1,a2,a3]
n=int(input())
b=[]
for j in range(n):
    B=[int(i) for i in input().split()]
    b.append(B)

hc1=[]
hc2=[]
hc3=[]

for i in b:
    for j in a1:
        if i==j:
            hc1.append("hit")
    for j in a2:
        if i==j:
            hc2.append("hit")     
    for j in a3:
        if i==j:
            hc3.append("hit")

#よこ
if hc1[0]=="hit" and hc1[1]=="hit" and hc1[2]=="hit"
    print("Yes")
elif hc2[0]=="hit" and hc2[1]=="hit" and hc2[2]=="hit"
    print("Yes")
elif hc3[0]=="hit" and hc3[1]=="hit" and hc3[2]=="hit"
    print("Yes")
#たて
elif hc1[0]=="hit" and hc2[0]=="hit" and hc3[0]=="hit"
    print("Yes")
elif hc1[1]=="hit" and hc2[1]=="hit" and hc3[1]=="hit"
    print("Yes")
elif hc1[2]=="hit" and hc2[2]=="hit" and hc3[2]=="hit"
    print("Yes")
#斜め
    elif hc1[0]=="hit" and hc2[1]=="hit" and hc3[2]=="hit"
    print("Yes")
    elif hc1[2]=="hit" and hc2[1]=="hit" and hc3[0]=="hit"
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
#bingo
a1=[int(i) for i in input().split()]
a2=[int(i) for i in input().split()]
a3=[int(i) for i in inpiut().split()]
a=[a1,a2,a3]
n=int(input())
b=[]
for j in range(n):
    B=[int(i) for i in input().split()]
    b.append(B)

hc1=[]
hc2=[]
hct3=[]

for i in b:
    for j in a1:
        if i==j:
            hc1.append("hit")
    for j in a2:
        if i==j:
            hc2.append("hit")     
    for j in a3:
        if i==j:
            hc3.append("hit")

#よこ
if hc1[0]=="hit" and hc1[1]=="hit" and hc1[2]=="hit"
    print("Yes")
elif hc2[0]=="hit" and hc2[1]=="hit" and hc2[2]=="hit"
    print("Yes")
elif hc3[0]=="hit" and hc3[1]=="hit" and hc3[2]=="hit"
    print("Yes")
#たて
elif hc1[0]=="hit" and hc2[0]=="hit" and hc3[0]=="hit"
    print("Yes")
elif hc1[1]=="hit" and hc2[1]=="hit" and hc3[1]=="hit"
    print("Yes")
elif hc1[2]=="hit" and hc2[2]=="hit" and hc3[2]=="hit"
    print("Yes")
#斜め
    elif hc1[0]=="hit" and hc2[1]=="hit" and hc3[2]=="hit"
    print("Yes")
    elif hc1[2]=="hit" and hc2[1]=="hit" and hc3[0]=="hit"
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n11, n12, n13 = (input().split())
n21, n22, n23 = (input().split())
n31, n32, n33 = (input().split())

lines = [[n11,n12,n13],
         [n21,n22,n23],
         [n31,n32,n33],
         [n11,n21,n31],
         [n12,n22,n32],
         [n13,n23,n33],
         [n11,n22,n33],
         [n13,n22,n31]]
nums = []
for(i in range(int(input()))):
  nums.append(input())
flag = false

Submission status: Runtime Error

Solution code:
n11, n12, n13 = int(input().split())
n21, n22, n23 = int(input().split())
n31, n32, n33 = int(input().split())
lines = [[n11,n12,n13],
         [n21,n22,n23],
         [n31,n32,n33],
         [n11,n21,n31],
         [n12,n22,n32],
         [n13,n23,n33],
         [n11,n22,n33],
         [n13,n22,n31]]
nums = []
for(i in range(int(input()))):
  nums.append(input())
flag = false
for(l in lines):
  if l[0] in nums:
    if l[1] in nums:
      if l[2] in nums:
        flag = True
if flag:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
# B problem
inp = [int(x) for x in input().rstrip('\n').split()]

bingo = inp[0:9]
b = inp[10:]

for i in b:
    for j in range(len(bingo)):
            if i == bingo[j]:
                bingo[j] = 0

true_list = list()
for i in [0, 3, 6]:
    if (bingo[i] + bingo[i+1] + bingo[i+2]) == 0:
        true_list.append(0)
for i in [0, 1, 2]:
    if (bingo[i] + bingo[i+3] + bingo[i+6]) == 0:
        true_list.append(0)
if (bingo[0] + bingo[4] + bingo[8]) == 0:
    true_list.append(0)
if (bingo[2] + bingo[4] + bingo[6]) == 0:
    true_list.append(0)

if not all(true_list):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
inp = [int(x) for x in input().split()]

bingo = inp[0:9]
b = inp[10:]

for i in b:
    for j in range(len(bingo)):
            if i == bingo[j]:
                bingo[j] = 0

true_list = list()
for i in [0, 3, 6]:
    if (bingo[i] + bingo[i+1] + bingo[i+2]) == 0:
        true_list.append(0)
for i in [0, 1, 2]:
    if (bingo[i] + bingo[i+3] + bingo[i+6]) == 0:
        true_list.append(0)
if (bingo[0] + bingo[4] + bingo[8]) == 0:
    true_list.append(0)
if (bingo[2] + bingo[4] + bingo[6]) == 0:
    true_list.append(0)

if not all(true_list):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))

A = A1 + A2 + A3
N = int(input())

index = []
for i in range(N):
    index.append(A.index(int(input())))

if (0 in index and 3 in index and 6 in index) or \
   (1 in index and 4 in index and 7 in index) or \
   (2 in index and 5 in index and 8 in index) or \
   (0 in index and 4 in index and 8 in index) or \
   (2 in index and 4 in index and 6 in index) or \
   (3 in index and 4 in index and 5 in index) or \
   (6 in index and 7 in index and 8 in index):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
S="012 345 678 036 147 258 048 246 "
A=sum([input().split()for i in range(4)],[])
for b in [input()for i in range(int(A[9]))]:
  if b in A:
    S=S.replace(str(A.index(b)),"")
print("YNeos"[1-"  "in S::2])

Submission status: Runtime Error

Solution code:
S="012 345 678 036 147 258 048 246 "
A=sum([input().split()for i in range(4)],[])
for b in [input()for i in range(int(A[10]))]:
  if b in A:
    S=S.replace(str(A.index(b)),"")
print("YNeos"[S.find("  ")<0::2])

Submission status: Runtime Error

Solution code:
def judge(board):
    for i in range(0, 3):
        if board[i][0] == board[i][1] == board[i][2] == 0 :
            return True
        if board[0][i] == board[1][i] == board[2][i] == 0:
            return True
    
    if board[0][0] == board[1][1] == board[2][2] == 0:
        return True
    if board[0][2] == board[1][1] == borad[2][0] == 0:
        return True
    
    return False


upper  = list(map(int, input().split(" ")))
middle = list(map(int, input().split(" ")))
lower  = list(map(int, input().split(" ")))

board = (upper,middle,lower)

N = int(input())
bingos = list()

for i in range(0, N):
    bingos.append(int(input()))

for i in range(0, N):
    for j in range(0, 3):
        if upper[j] == bingos[i]:
            board[0][j] = 0
            break
        elif middle[j] == bingos[i]:
            board[1][j] = 0
            break
        elif lower[j] == bingos[i]:
            board[2][j] = 0
            break
        else:
            pass

if judge(board):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
def judge(board):
    for i in range(0, 3):
        if board[i][0] == board[i][1] == board[i][2] == 0 :
            return True
        if board[0][i] == board[1][i] == board[2][i] == 0:
            return True
    
    if board[0][0] == board[1][1] == board[2][2] == 0:
        return True
    if board[0][2] == board[1][1] == borad[2][0] == 0:
        return True
    
    return False


upper  = list(map(int, input().split(" ")))
middle = list(map(int, input().split(" ")))
lower  = list(map(int, input().split(" ")))

board = (upper,middle,lower)

N = int(input())
bingos = list()

for i in range(0, N):
    bingos.append(int(input()))

for i in range(0, len(bingos)):
    for j in range(0, 3):
        if upper[j] == bingos[i]:
            board[0][j] = 0
            break
        elif middle[j] == bingos[i]:
            board[1][j] = 0
            break
        elif lower[j] == bingos[i]:
            board[2][j] = 0
            break
        else:
            pass

if judge(board):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
def judge(board):
    for i in range(0, 3):
        if board[i][0] == board[i][1] == board[i][2] :
            return True
        if board[0][i] == board[1][i] == board[2][i]:
            return True
    
    if board[0][0] == board[1][1] == board[2][2]:
        return True
    if board[0][2] == board[1][1] == borad[2][0]:
        return True
    
    return False


upper  = list(map(int, input().split(" ")))
middle = list(map(int, input().split(" ")))
lower  = list(map(int, input().split(" ")))

board = (upper,middle,lower)

N = int(input())
bingos = list()

for i in range(0, N):
    bingos.append(int(input()))

for i in range(0, len(bingos)):
    for j in range(0, 3):
        if upper[j] == bingos[i]:
            board[0][j] = 0
            break
        elif middle[j] == bingos[i]:
            board[1][j] = 0
            break
        elif lower[j] == bingos[i]:
            board[2][j] = 0
            break
        else:
            pass

if judge(board):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
A = []
for i in range(3):
    A.append(list(input().split()))
N = int(input())
B = []
for i in range(N):
    B.append(input())
B=set(B)
if set(A[0]) <= B or set(A[1]) <= B or set(A[2]) <= B or {A[0][0], A[1][0], A[2][0]} <= B or\
{A[0][1], A[1][1], A[2][1]} <= B or {A[0][2], A[1][2], A[2][2]} <= B \
or {A[0][0], A[1][1], A[2][2]} <= B or {A[0][2], A[1][1], A[2][0]} <= setB:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
A = []
for i in range(3):
    A.append(list(input().split()))
N = int(input())
B = []
for i in range(N):
    B.append(input())
B=set(B)
if {A[0]} <= B or {A[1]} <= B or {A[2]} <= B or {A[0][0], A[1][0], A[2][0]} <= B or\
 {A[0][1], A[1][1], A[2][1]} <= B or {A[0][2], A[1][2], A[2][2]} <= B or {A[0][0], A[1][1], A[2][2]} <= B or {A[2][2], A[1][1], A[2][0]} <= B:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
A = []
for i in range(3):
    A.append(list(input().split()))
N = int(input())
B = set()
for i in range(N):
    B.append(input())
if {A[0]} <= B or {A[1]} <= B or {A[2]} <= B or {A[0][0], A[1][0], A[2][0]} <= B or {A[0][1], A[1][1], A[2][1]} <= B or {A[0][2], A[1][2], A[2][2]} <= B or {A[0][0], A[1][1], A[2][2]} <= B or {A[2][2], A[1][1], A[2][0]} <= B:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
A = []
for i in range(3):
    A.append(list(input().split()))
N = int(input())
B = set()
for i in range(N):
    B.append(input())
if {A[0]} <= B or {A[1]} <= B or {A[2]} <= B or {A[0][0], A[1][0], A[2][0]} <= B or {A[0][1], A[1][1], A[2][1]} <= B or \
{A[0][2], A[1][2], A[2][2]} <= B or {A[0][0], A[1][1], A[2][2]} <= B or {A[2][2], A[1][1], A[2][0]} <= B:
print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
A = []
for i in range(3):
    A.append(list(input().split()))
N = int(input())
B = set()
for i in range(N):
    B.append(input())
if {A[0]} <= B or {A[1]} <= B or {A[2]} <= B or {A[0][0], A[1][0], A[2][0]} <= B, {A[0][1], A[1][1], A[2][1]} <= B or //
{A[0][2], A[1][2], A[2][2]} <= B or {A[0][0], A[1][1], A[2][2]} <= B or {A[2][2], A[1][1], A[2][0]} <= B:
print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]

cards = A[0] + A[1] + A[2]

for b in B:
    cards = [c if c != b else 0 for c in cards]

if (sum(A[0:3]) == 0):
    print('Yes')
elif (sum(A[3:6]) == 0):
    print('Yes')
elif (sum(A[7:9]) == 0):
    print('Yes')
elif ((A[0] + A[3] + A[6]) == 0):
    print('Yes')
elif ((A[1] + A[4] + A[7]) == 0):
    print('Yes')
elif ((A[2] + A[5] + A[8]) == 0):
    print('Yes')
elif ((A[0] + A[4] + A[8]) == 0):
    print('Yes')
elif ((A[2] + A[4] + A[6]) == 0):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
s = []
a = [[s.append(i) for i in line.split(" ")] for line in input().split()]
nums = []
[[nums.append(num) for num in row.split(" ")] for row in s[:9]]
n = int(s[9])
bs = s[10:]
mat = [num in bs for num in nums]
patterns = [[0, 1, 2],
            [0, 4, 8],
            [0, 3, 6],
            [1, 4, 7],
            [2, 4, 6],
            [2, 5, 8],
            [3, 4, 5],
            [6, 7, 8]]
for pat in patterns:
    if mat[pat[0]] and mat[pat[1]] and mat[pat[2]]:
        print("Yes")

Submission status: Runtime Error

Solution code:
for i in range(3):
	L[i] = list(map(int,input().split()))
import numpy as np
L=[]
bingo = np.zeros([3,3])
for i in range(3):
	L.append(input().split())
L = list(np.reshape(L,9))
N = int(input())
for i in range(N):
	l = input()
	if l in L:
		ptr = L.index(l)
		bingo[ptr/3,ptr%3]=1
#print(bingo)
ans = "No"
flg = 0
for i in range(3):
	flg = flg or bingo[i,0] and bingo[i,1] and bingo[i,2]
for i in range(3):
	flg = flg or bingo[0,i] and bingo[1,i] and bingo[2,i]
flg = flg or bingo[0,0] and bingo[1,1] and bingo[2,2]
flg = flg or bingo[2,0] and bingo[1,1] and bingo[0,2]
if flg == 1:
	ans = "Yes"
print(ans)

Submission status: Runtime Error

Solution code:
s = input().split()
nums = []
[[nums.append(num) for num in row.split(" ")] for row in s[:9]]
n = int(s[9])
bs = s[10:]
mat = [num in bs for num in nums]
patterns = [[0, 1, 2],
            [0, 4, 8],
            [0, 3, 6],
            [1, 4, 7],
            [2, 4, 6],
            [2, 5, 8],
            [3, 4, 5],
            [6, 7, 8]]
for pat in patterns:
    if mat[pat[0]] and mat[pat[1]] and mat[pat[2]]:
        print("Yes")

Submission status: Runtime Error

Solution code:
s = input().split()
nums = []
[[nums.append(num) for num in row] for row in s[:3]]
n = int(s[3])
bs = s[4:]
mat = [num in bs for num in nums]
patterns = [[1, 2, 3],
            [1, 5, 9],
            [1, 4, 7],
            [2, 5, 8],
            [3, 5, 7],
            [3, 6, 9],
            [4, 5, 6],
            [7, 8, 9]]
for pat in patterns:
    if mat[pat[0]] and mat[pat[1]] and mat[pat[2]]:
        print("Yes")

Submission status: Runtime Error

Solution code:
s = input().split()
nums = []
[[nums.append(num) for num in row] for row in s[:3]]
n = int(s[3])
bs = s[4:]
mat = [num in bs for num in nums]
pattterns = [[1, 2, 3],
             [1, 5, 9],
             [1, 4, 7],
             [2, 5, 8],
             [3, 5, 7],
             [3, 6, 9],
             [4, 5, 6],
             [7, 8, 9]]
for pat in patterns:
    if mat[pat[0]] and mat[pat[1]] and mat[pat[2]]:
        print("Yes")

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
s = input.split()
nums = []
[[nums.append(num) for num in row] for row in s[:3]]
n = int(s[3])
bs = s[4:]
mat = [num in bs for num in nums]
pattterns = [[1, 2, 3],
                [1, 5, 9],
                [1, 4, 7],
                [2, 5, 8],
                [3, 5, 7],
                [3, 6, 9],
                [4, 5, 6],
                [7, 8, 9]]
for pat in patterns:
    if mat[pat[0]] and mat[pat[1]] and mat[pat[2]]:
        print("Yes")

Submission status: Runtime Error

Solution code:
a=[[] for _ in range(3)]
for i in range(3):
  a[i]=list(map(int,input().split()))
l=[]
N=int(input())
for i in range(N):
  n=int(input())
  for i in range(3):
    for j in range(3):
      if a[i][j]==n:
        l.append([i,j])

def judge(l):
  if len(l)<=2:
    return 'No'
  else:
    if [0,0] in l and [1,1] in l and [2,2] in l:
      return 'Yes'
    else:
      dic1={}
      dic2={}
      for ij in l:
        i,j=ij[0],ij[1]
        if i not in dic1.keys():
          dic1[i]=1
        else:
          dic1[i]+=1
          if dci1[i]==3:
            return 'Yes'
        if j not in dic2.keys():
          dic2[j]=1
        else:
          dic2[j]+=1
          if dic2[j]==3:
            return 'Yes'
      return 'No'
print(judge(l))

Submission status: Runtime Error

Solution code:
a=[[] for _ in range(3)]
for i in range(3):
  a[i]=list(map(int,input().split()))
l=[]
N=int(input())
for i in range(N):
  n=int(input())
  for i in range(3):
    for j in range(3):
      if a[i][j]==n:
        l.append([i,j])

def judge(l):
  if len(l)<=2:
    return 'No'
  else:
    if [0,0] in l and [1,1] in l and [2,2] in l:
      return 'Yes'
    else:
      dic1={}
      dic2={}
      for ij in l:
        i,j=l[0],l[1]
        if i not in dic1.keys():
          dic1[i]=1
        else:
          dic1[i]+=1
          if dci1[i]==3:
            return 'Yes'
        if j not in dic2.keys():
          dic2[j]=1
        else:
          dic2[j]+=1
          if dic2[j]==3:
            return 'Yes'
      return 'No'
print(judge(l))

Submission status: Runtime Error

Solution code:
a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for number in b:
    for i in range(3):
        if number in a[i]:
            a[i][a[i].index(number)] = 0
if a[0][0] == a[1][1] == a[2][2] == 0 or a[2][0] == a[1][1] == a[0][2] == 0:
    print('Yes')
else:
    for i in range(3):
        if a[i][0] == a[i][1] == a[i][2] == 0:
            print('Yes')
            break
        elif a[0][i] == a[1][i] == a[2][i] == 0:
            print('Yes')
            break
    	else:
        	print('No')

Submission status: Runtime Error

Solution code:
a = [list(map(int,input().split())) for i in range(3)] #ビンゴ表
n = int(input()) #回数
b = [int(input()) for i in range(n)] #出た数字

for number in b: #出た目を順番に確認
    for i in range(3):
        if number in a[i]: #numberがビンゴ表にあるかチェック
            a[i][a[i].index(number)] = 0 #i行のnumberに該当する要素を0に書き変え

if a[0][0] == a[1][1] == a[2][2] == 0 or a[2][0] == a[1][1] == a[0][2] == 0:
    print('Yes')　#斜めのビンゴをチェック
else:
    for i in range(3):
        if a[i][0] == a[i][1] == a[i][2] == 0:
            print('Yes') #行のビンゴをチェック
            break
        elif a[0][i] == a[1][i] == a[2][i] == 0:
            print('Yes') #列のビンゴをチェック
            break
        else:
            print('No')

Submission status: Runtime Error

Solution code:
a = [[j for j in map(int,input().split())] for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]

for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j] == b[k]:
                a[i][j] = 0

if sum(a[0,:]) == 0 or sum(a[1,:]) == 0 or sum(a[2,:]) == 0:
    print('Yes')
elif sum(a[:,0]) == 0 or sum(a[:,1]) == 0 or sum(a[:,2]) == 0:
    print('Yes')
elif (a[0][0] + a[1][1] + a[2][2]) == 0 or (a[0][2] + a[1][1] + a[2][0]) == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
A=[[int(i) for i in input().split()] for _ in range(3)]
N=int(input())
for _ in range(N):
    b=int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j]==b:
                A[i][j]=-1
flag=False
for h in range(3):
    cnt=0
    for w in range(3):
        if A[h][w]==-1:
            cnt+=1
    if cnt==3:
        flag=True
for w in range(3):
    cnt=0
    for h in range(3):
        if A[h][w]==-1:
            cnt+=1
    if cnt==3:
        flag=True
cnt=0
if A[d][d]==-1:
    cnt+=1
if cnt==3:
    flag=True
cnt=0
if A[d][-d]==-1:
    cnt+=1
if cnt==3:
    flag=True
print('Yes' if flag else 'No')

Submission status: Runtime Error

Solution code:
a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for number in b:
    for i in range(3):
        if number in a[i]:
            a[i][a[i].index(number)] = 0
if a[0][0] == a[1][1] == a[2][2] == 0　or a[2][0] == a[1][1] == a[0][2]:
    print('Yes')
else:
    for i in range(3):
        if a[i][0] == a[i][1] == a[i][2] == 0:
            print('Yes')
            break
        elif a[0][i] == a[1][i] == a[2][i] == 0:
            print('Yes')
            break
    else:
        print('No')

Submission status: Runtime Error

Solution code:
a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for number in b:
    for i in range(3):
        if number in a[i]:
            a[i][a[i].index(number)] = 0
if a[0][0] == a[1][1] == a[2][2] == 0　and a[2][0] == a[1][1] == a[0][2]:
    print('Yes')
else:
    for i in range(3):
        if a[i][0] == a[i][1] == a[i][2] == 0:
            print('Yes')
            break
        elif a[0][i] == a[1][i] == a[2][i] == 0:
            print('Yes')
            break
    else:
        print('No')

Submission status: Runtime Error

Solution code:
a=[[int(input())for _ in range(3)]for _ in range(3)]
n=int(input())
b=[int(input())for _ in range(n)]
for i in b:
  for j in range(3):
    for k in range(3):
      if i==a[j][k]:a[j][k]=0
ans="No"
for i in range(3):
  if a[i][0]==a[i][1]==a[i][2]:ans="Yes"
  if a[0][i]==a[1][i]==a[2][i]:ans="Yes"
if a[0][0]==a[1][1]==a[2][2]:ans="Yes"
if a[0][2]==a[1][1]==a[2][0]:ans="Yes"
print(ans)

Submission status: Runtime Error

Solution code:
for number in b:
    for i in range(3):
        if number in a[i]:
            a[i][a[i].index(number)] = 0
if a[0][0] == a[1][1] == a[2][2] == 0:
    print('Yes')
else:
    for i in range(3):
        if a[i][0] == a[i][1] == a[i][2] == 0:
            print('Yes')
            break
        elif a[0][i] == a[1][i] == a[2][i] == 0:
            print('Yes')
            break
    else:
        print('No')

Submission status: Runtime Error

Solution code:
Card=[list(map(int,input().split())) for i in range(3)]
N=int(input())
b=[int(input()) for i in range(N)]
for i in range(N):
    for j in range(3):
        for k in range(3):
            if A[j][k]==b[i]:
                A[j][k]=0
if (A[0][0]==A[0][1]==A[0][2]==0) or (A[1][0]==A[1][1]==A[1][2]==0) or (A[2][0]==A[2][1]==A[2][2]==0) or (A[0][0]==A[1][0]==A[2][0]==0) or (A[0][1]==A[1][1]==A[2][1]==0)  or (A[0][2]==A[1][2]==A[2][2]==0) or (A[0][0] == A[1][1] == A[2][2] == 0) or (A[2][0]==A[1][1]==A[0][2]==0):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import itertools as it
dic={}
bing=[[1 for i in range(3)] for j in range(3)]
for i in range(3):
    f=list(map(int,input().split()))
    for each in f:
        dic.update({each:(i,f.index(each))})
n=int(input())
for i in range(n):
    m=int(input())
    place=dic[m]
    bing[place[0]][place[1]]=0
flag=False
code="000102101112202122"
code=code+code[::-1]
code=code+"001122021120"

for i in range(8):
    code_sep=code[6*i:6*i+6]
    p=0
    for j in range(3):
        cords=code_sep[2*j:2*j+2]
        p+=bing[int(cords[0])][int(cords[1])]
    if p==0:
        flag=True
        break
    
print("Yes")if flag else print("No")

Submission status: Runtime Error

Solution code:
import itertools as it
dic={}
bing=[[0 for i in range(3)] for j in range(3)]
for i in range(3):
    f=list(map(int,input().split()))
    for each in f:
        dic.update({each:(i,f.index(each))})
n=int(input())
for i in range(n):
    m=int(input())
    place=dic[m]
    bing[place[0]][place[1]]=1
flag=False
code="000102101112202122"
code=code+code[::-1]
code=code+"001122021120"

for i in range(8):
    code_sep=code[6*i:6*i+6]
    p=1
    for j in range(3):
        cords=code_sep[2*j:2*j+2]
        p*=bing[int(cords[0])][int(cords[1])]
    if p==1:
        flag=True
        break
    
print("Yes")if flag else print("No")

Submission status: Runtime Error

Solution code:
bing=[]
for i in range(3):
  bing.append(list(map(int,input().aplit())))
import itertools as it
dic={}
bing=[[1 for i in range(3)] for j in range(3)]
for i in range(3):
    f=list(map(int,input().split()))
    for each in f:
        dic.update({each:(i,f.index(each))})
n=int(input())
for i in range(n):
    m=int(input())
    place=dic[m]
    bing[place[0]][place[1]]=0
flag=False
code="000102101112202122"
code=code+code[::-1]
code=code+"001122021120"

for i in range(8):
    code_sep=code[6*i:6*i+6]
    p=0
    for j in range(3):
        cords=code_sep[2*j:2*j+2]
        p+=bing[int(cords[0])][int(cords[1])]
    if p==0:
        flag=True
        break
    
print("yes")if flag else print("No")

Submission status: Runtime Error

Solution code:
a = [[j for j in map(int,input().split())] for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]

for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j] == b[k]:
                a[i][j] = 0

if sum(a[0:]) == 0 or sum(a[1:]) == 0 or sum(a[2:]) == 0:
    print('Yes')
elif sum(a[:0]) == 0 or sum(a[:1]) == 0 or sum(a[:2]) == 0:
    print('Yes')
elif (a[0][0] + a[1][1] + a[2][2]) == 0 or (a[0][2] + a[1][1] + a[2][0]) == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a = [[j for j in map(int,input().split())] for i in range(3)]
n = int(input())
b = [[int(j) for j in input()] for i in range(n)]

for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j] == b[k]:
                a[i][j] = 0

if sum(a[0]) == 0 or sum(a[1]) == 0 or sum(a[2]) == 0:
    print('Yes')
elif (a[0][0] + a[1][1] + a[2][2]) == 0 or (a[0][2] + a[1][1] + a[3][0]) == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a = [[j for j in map(int,input().split())] for i in range(3)]
n = int(input())
b = [[int(j) for j in input()] for i in range(n)]

for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j] == b[k]:
                a[i][j] = 0

if sum(a[0]) == 0 or sum(a[1]) == 0 or sum(a[2]) == 0:
    print('Yes')
elif a[0][0] + a[1][1] + a[2][2] == 0 or a[0][2] + a[1][1] + a[3][0] == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a = [[j for j in map(int,input().split())] for i in range(3)]
n = int(input())
b = [[int(j) for j in input()] for i in range(n)]

for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j] == b[k]:
                a[i][j] = 0

if sum(a[0]) == 0 or sum(a[1]) == 0 or sum(a[2] == 0):
    print('Yes')
elif a[0][0] + a[1][1] + a[2][2] or a[0][2] + a[1][1] + a[3][0]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a1_1, a1_2, a1_3 = map(int, input().split())
a2_1, a2_2, a2_3 = map(int, input().split())
a3_1, a3_2, a3_3 = map(int, input().split())
a_list=[a1_1, a1_2, a1_3, a2_1, a2_2, a2_3, a3_1, a3_2, a3_3]
n = int(input())
b=[]
for i in range(n):
  b_i = int(input())
  b.append(b_i)
  for j in range(len(a_list)):
    if a_list[j] == b_i:
      a_list[j] = -1
if ((a_list[0]==-1 and a_list[1] == -1 and a_list[2] == -1) or
    (a_list[3]==-1 and a_list[4] == -1 and a_list[5] == -1) or
    (a_list[6]==-1 and a_list[7] == -1 and a_list[8] == -1) or
    (a_list[0]==-1 and a_list[3] == -1 and a_list[6] == -1) or
    (a_list[1]==-1 and a_list[4] == -1 and a_list[7] == -1) or
    (a_list[2]==-1 and a_list[5] == -1 and a_list[8] == -1):
  print("Yes")
else:
  print("No")