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.

Solution (Python):
A11,A12,A13 = map(int, input().split())
A21,A22,A23 = map(int, input().split())
A31,A32,A33 = map(int, input().split())
bingos = [(A11, A12, A13), (A21, A22, A23), (A31, A32, A33), (A11, A21, A31), (A12, A22, A32), (A13, A23, A33), (A11, A22, A33), (A13, A22, A31)]
bingo_cnt = [0,0,0,0,0,0,0,0]
N = int(input())
for i in range(N):
  b_temp = int(input())
  for j in range(len(bingos)):
    if b_temp in bingos[j]:
      bingo_cnt[j] += 1
if max(bingo_cnt) == 3:
  print('Yes')
else:
  print('No')

Solution (Python):
s,a=',036,048,246,258,345,678,',open(0).read().split()
for i in a[9:]:s=s.replace(str(a.index(i)),'')
print('NYoe s'[',,'in s::2])

Solution (Python):
A = []
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))
N = int(input())
b = [int(input()) for i in range(N)]
cor = [[0 for _ in range(3)] for _ in range(3)]
ans = 'No'

for i in range(N):
    for j in range(3):
        for k in range(3):
            if b[i] == A[j][k]:
                cor[j][k] = 1

for i in range(3):
    if cor[i][0] == 1 and cor[i][1] == 1 and cor[i][2] == 1:
        ans = 'Yes'
    if cor[0][i] == 1 and cor[1][i] == 1 and cor[2][i] == 1:
        ans = 'Yes'    

if cor[0][0] == 1 and cor[1][1] == 1 and cor[2][2] == 1:
    ans = 'Yes'
if cor[0][2] == 1 and cor[1][1] == 1 and cor[2][0] == 1:
    ans = 'Yes'
    
print(ans)

Solution (Python):
A=[]
for i in range(3):
    A.append(list(map(int,input().split())))
N=int(input())
for i in range(N):
    b=int(input())
    for ii in range(3):
        for iii in range(3):
            if A[ii][iii]==b:
                A[ii][iii]=0

flag=False
for i in range(3):
    if A[i][:]==[0,0,0]:
        flag=True
    elif A[0][i]==0 and A[1][i]==0 and A[2][i]==0:
        flag=True
    elif A[1][1]==0:
        if A[0][2]==0 and A[2][0]==0:
            flag=True
        elif A[0][0]==0 and A[2][2]==0:
            flag=True
if flag:
    print('Yes')
else:
    print('No')

Solution (Python):
number = []
result = "No"

for i in range(3):
	for n in input().split():
		n = int(n)
		number.append(n)

bingo = [None for _ in range(9)]

N  = int(input())
for i in range(N):
	b = int(input())
	for j in range(9):
		if b == number[j]:
			bingo[j] = True


for i in range(3):
	if bingo[3*i] == bingo[3*i+1] and bingo[3*i+1] == bingo[3*i+2] and bingo[3*i] == True:
		result = "Yes"

for i in range(3):
	if bingo[i] == bingo[3+i] and bingo[3+i] == bingo[6+i] and bingo[i] == True:
		result = "Yes"

if bingo[0] == bingo[4] and bingo[4] == bingo[8] and bingo[0] == True:
	result = "Yes"

if bingo[2] == bingo[4] and bingo[4] == bingo[6] and bingo[2] == True:
	result = "Yes"

print(result)

Solution (Python):
import itertools

A = [input().split() for _ in range(3)]
A = list(itertools.chain.from_iterable(A))
N = int(input())
B = [input() for _ in range(N)]

l = [a in B for a in A]
if l[0] == l[1] == l[2] == True:
    print("Yes")
elif l[3] == l[4] == l[5] == True:
    print("Yes")
elif l[6] == l[7] == l[8] == True:
    print("Yes")
elif l[0] == l[3] == l[6] == True:
    print("Yes")
elif l[1] == l[4] == l[7] == True:
    print("Yes")
elif l[2] == l[5] == l[8] == True:
    print("Yes")
elif l[0] == l[4] == l[8] == True:
    print("Yes")
elif l[2] == l[4] == l[6] == True:
    print("Yes")
else:
    print("No")

Solution (Python):
S = [[int(i) for i in input().split()] for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]
check = 0

for num in b:
    for i in range(3):
        for j in range(3):
            if S[i][j] == num:
                S[i][j] = '*'

if len(set(S[0])) == 1 or len(set(S[1])) == 1 or len(set(S[2])) == 1:
    check = 1

for i in range(3):
    cnt = 0
    for j in range(3):
        if S[j][i] == '*':
            cnt += 1
    if cnt == 3:
        check = 1

if S[0][0] == S[1][1] == S[2][2] == '*' or S[0][2] == S[1][1] == S[2][0] == '*':
    check = 1

if check == 1:
    print('Yes')
else:
    print('No')

Solution (Python):
A = list()

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

A.append(A1)
A.append(A2)
A.append(A3)

N = int(input())

b = list()
for i in range(N):
    b.append(int(input()))

for x in range(N):
    for y in range(3):
        for z in range(3):
            if b[x] == A[y][z]:
                A[y][z] = 101


for i in range(3):
    counter = 0
    counter3 = 0
    for j in range(3):
        if A[i][j] == 101:
            counter += 1
        if A[j][i] == 101:
            counter3 += 1
        if counter == 3 or counter3 == 3:
            break
    if counter == 3 or counter3 == 3:
        break
if counter == 3 or counter3 == 3:
    print('Yes')

else:
    counter1 = 0
    for i in range(3):
        if A[i][i] == 101:
            counter1 += 1
    if counter1 == 3:
        print('Yes')
    else:
        counter2 = 0
        for i in range(3):
            if A[i][2-i] == 101:
                counter2 += 1
        if counter2 == 3:
            print('Yes')
        else:
            print('No')

Solution (Python):
def check(A):
	if A[0][0] == 0 and A[1][1] == 0 and A[2][2] == 0:
		return 1
	elif A[2][0] == 0 and A[1][1] == 0 and A[0][2] == 0:
		return 1
	for i in range(3):
		if A[0][i] == 0 and A[1][i] == 0 and A[2][i] == 0:
			return 1
		elif A[i][0] == 0 and A[i][1] == 0 and A[i][2] == 0:
			return 1
	return 0
			


A = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]

for i in range(3):
	for j in range(3):
		if A[i][j] in b:
			A[i][j] = 0

if check(A):
	print('Yes')
else:
	print('No')

Solution (Python):



a = []
a.append(list(input().split()))
a.append(list(input().split()))
a.append(list(input().split()))

def kezuru(b):
    for i in range(len(a)):
        for j in range(len(a[i])):
            if b == a[i][j]:
                a[i][j] = '*'
        

n = int(input())
for i in range(n):
    b = input()
    kezuru(b)
    
def check():
    for i in range(3):
        if a[i][0] == a[i][1] and a[i][0] == a[i][2]:
            return 'Yes'
    for i in range(3):
        if a[0][i] == a[1][i] and a[0][i] == a[2][i]:
            return 'Yes'
    if a[0][0] == a[1][1] and a[0][0] == a[2][2]:
        return 'Yes'
    if a[0][2] == a[1][1] and a[0][2] == a[2][0]:
        return 'Yes'
    return 'No'
    
print(check())

Solution (Python):

A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3 = list(map(int,input().split()))
N = int(input())
b = [int(input())for _ in range(N)]
if (A1[0] in b)and (A1[1]in b)and (A1[2] in b):
    print('Yes')
elif (A2[0]in b)and(A2[1] in b)and(A2[2]in b):
    print('Yes')
elif (A3[0]in b)and(A3[1]in b)and (A3[2]in b):
    print('Yes')
elif (A1[0]in b)and(A2[0]in b)and(A3[0]in b):
    print('Yes')
elif (A1[1]in b)and (A2[1]in b)and(A3[1]in b):
    print('Yes')
elif (A1[2] in b)and (A2[2]in b)and(A3[2]in b):
    print('Yes')
elif (A1[0]in b)and (A2[1]in b)and(A3[2]in b):
    print('Yes')
elif (A1[2]in b)and (A2[1]in b)and(A3[0]in b):
    print('Yes')
else:
    print('No')

Solution (Python):
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]
B = [[0,0,0],[0,0,0],[0,0,0]]

ans = 'No'
for i, row in enumerate(A):
    for j, value in enumerate(row):
        if value in b:
            B[i][j] = 1

if B[0][0]==B[0][1]==B[0][2]==1 or B[1][0]==B[1][1]==B[1][2]==1 or B[2][0]==B[2][1]==B[2][2]==1:
    ans = 'Yes'
elif B[0][0]==B[1][0]==B[2][0]==1 or B[0][1]==B[1][1]==B[2][1]==1 or B[0][2]==B[1][2]==B[2][2]==1:
    ans = 'Yes'
elif B[0][0]==B[1][1]==B[2][2]==1 or B[0][2]==B[1][1]==B[2][0]==1:
    ans = 'Yes'
print(ans)

Solution (Python):


A = []
for i in range(1,4):
    x = map(int,input().split())
    A.append(list(x))

N = int(input())

b = []
for i in range(1,N+1):
    y = int(input())
    b.append(y)

    
for i in A:
    for j in range(0,3):
        i[j] = (i[j] in b)


tate = []
yoko = []
naname = []

for i in range(0,3):
    tate.append(A[0][i]*A[1][i]*A[2][i])
for i in range(0,3):
    yoko.append(A[i][0]*A[i][1]*A[i][2])
    

naname.append(A[0][0]*A[1][1]*A[2][2])
naname.append(A[0][2]*A[1][1]*A[2][0])

ans = sum(tate)+sum(yoko)+sum(naname)
if ans == 0:
    print('No')
else:
    print('Yes')

Solution (Python):
a11,a12,a13=map(int,input().split())
a21,a22,a23=map(int,input().split())
a31,a32,a33=map(int,input().split())

n=int(input())

card=[a11,a12,a13,a21,a22,a23,a31,a32,a33]
def isBingo():
   if ( (card[0] == -1 and card[1] == -1 and card[2] == -1) \
      or (card[3] == -1 and card[4] == -1 and card[5] == -1) \
      or (card[6] == -1 and card[7] == -1 and card[8] == -1) \
      or (card[0] == -1 and card[3] == -1 and card[6] == -1) \
      or (card[1] == -1 and card[4] == -1 and card[7] == -1) \
      or (card[2] == -1 and card[5] == -1 and card[8] == -1) \
      or (card[0] == -1 and card[4] == -1 and card[8] == -1) \
      or (card[2] == -1 and card[4] == -1 and card[6] == -1) \
      ):
      return True
   else:
      return False
    
for i in range(n):
  i= int(input())
  if i in card:
    card[card.index(i)]=-1
if( isBingo()):
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
def getInput():
    return [int(i) for i in input().rstrip().split(' ')]
def checkBingo(holes):
    holes_x = [list(x) for x in zip(*holes)]
    _a,_b = True,True
    for i in range(3):
        if not None in holes[i] or not None in holes_x[i]:
            return True
        
        if None is holes[i][i]:_a=False
        if None is holes[i][2-i]: _b=False
    return (_a ==True or _b == True)
bingo = []
holes = []
for i in range(3):
    bingo += [getInput()]
for i in bingo:
    holes += [[None for n in i]]
N = getInput()[0]
for i in range(N):
    num = getInput()[0]
    for h in range(3):
        for w in range(3):
            if num == bingo[h][w]:
                holes[h][w] = 1
                break
    if checkBingo(holes):
        print('Yes')
        sys.exit()
print('No')

Solution (Python):
a11,a12,a13=map(int,input().split())
a21,a22,a23=map(int,input().split())
a31,a32,a33=map(int,input().split())
n=int(input())

card = [a11,a12,a13,a21,a22,a23,a31,a32,a33]
def isBingo() :
    if ( (card[0] == -1 and card[1] == -1 and card[2] == -1) \
      or (card[3] == -1 and card[4] == -1 and card[5] == -1) \
      or (card[6] == -1 and card[7] == -1 and card[8] == -1) \
      or (card[0] == -1 and card[3] == -1 and card[6] == -1) \
      or (card[1] == -1 and card[4] == -1 and card[7] == -1) \
      or (card[2] == -1 and card[5] == -1 and card[8] == -1) \
      or (card[0] == -1 and card[4] == -1 and card[8] == -1) \
      or (card[2] == -1 and card[4] == -1 and card[6] == -1) \
      ) :
        return True
    else :
        return False

ans = "No"
for x in range(n) :
    s = int(input())
    if s in card :
        card[card.index(s)] = -1
    if( isBingo() ) :
        ans = "Yes"

print(ans)

Solution (Python):
A = [list(map(int,input().split())) for i in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]
a = [[False]*3 for i in range(3)]
for i in range(3):
    for j in range(3):
        for b in B:
            if A[i][j]==b:
                a[i][j]=True

bingo=False
for i in range(3):
    if a[i][0] and a[i][1] and a[i][2]:
        bingo=True
for j in range(3):
    if a[0][j] and a[1][j] and a[2][j]:
        bingo=True
if a[0][0] and a[1][1] and a[2][2]:
    bingo=True
if a[2][0] and a[1][1] and a[0][2]:
    bingo=True
print("Yes" if bingo else "No")

Solution (Python):
import numpy as np
card = np.array([list(map(int,input().split())),\
                 list(map(int,input().split())),\
                 list(map(int,input().split()))])
N = int(input())
for i in range(N):
  card[card == int(input())] = 0
print('No' if str(np.all(card == 0, axis = 0)) == '[False False False]' and\
              str(np.all(card == 0, axis = 1)) == '[False False False]' and\
              sum(np.diag(card)) != 0 and\
			  sum(np.choose([2, 1, 0], card)) != 0 else 'Yes')

Solution (Python):
a = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
for i in range(3):
  for j in b:
    if a[i].count(j) > 0:
      a[i][a[i].index(j)] = -1

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

Solution (Python):
l = []
for i in range(3):
  a = [int(x) for x in input().split()]
  l.append(a)
n = int(input())
b = []
for i in range(n):
  b.append(int(input()))
for x in range(3):
  for y in range(3):
    for i in range(n):
      if l[x][y] == b[i]:
        l[x][y] = 0
hantei = "No"
for i in range(3):
  if l[i][0] == l[i][1] and l[i][1] == l[i][2]:
    hantei = "Yes"
    break
  elif l[0][i] == l[1][i] and l[1][i] == l[2][i]:
    hantei = "Yes"
    break
if l[0][2] == l[1][1] and l[1][1] == l[2][0]:
  hantei = "Yes"
elif l[0][0] == l[1][1] and l[1][1] == l[2][2]:
  hantei ="Yes"
print(hantei)

Solution (Python):
def judge(A):
    if A[0][0]==A[1][1]==A[2][2]=="o" or A[0][2]==A[1][1]==A[2][0]=="o":
        return "Yes"
    for i in range(3):
        if A[i][0]==A[i][1]==A[i][2]=="o" or A[0][i]==A[1][i]==A[2][i]=="o":
            return "Yes"
    return "No"
a1=input().split()
a2=input().split()
a3=input().split()
A=[a1,a2,a3]
N=int(input())
for n in range(N):
    p=0
    b=input()
    for i in range(3):
        for j in range(3):
            if b==A[i][j]:
                A[i][j]="o"
                p=1
                break
        if p==1:
            break
print(judge(A))

Solution (Python):
a_1_1, a_1_2, a_1_3 = map(int, input().split())
a_2_1, a_2_2, a_2_3 = map(int, input().split())
a_3_1, a_3_2, a_3_3 = map(int, input().split())
n = int(input())
b = [int(input()) for _ in range(n)]
a = []
a.extend((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))
for _ in range(len(a)):
    if a[_] in b:
        a[_] = 0

def is_bingo(num_1, num_2, num_3):
    if num_1 == num_2 == num_3:
        return True

if is_bingo(a[0], a[1], a[2]) or is_bingo(a[3], a[4], a[5]) or is_bingo(a[6], a[7], a[8]) or is_bingo(a[0], a[3], a[6]) or is_bingo(a[1], a[4], a[7]) or is_bingo(a[2], a[5], a[8]) or is_bingo(a[0], a[4], a[8]) or is_bingo(a[2], a[4], a[6]):
    print("Yes")
else:
    print("No")

Solution (Python):
import numpy as np

A = np.zeros((3, 3), dtype=int)
for i in range(3):
    A[i, :] = [int(x) for x in input().split()]
N = int(input())
b = np.zeros(N, dtype=int)
for i in range(N):
    b[i] = int(input())

for i in range(3):
    for j in range(3):
        if A[i, j] in b:
            A[i, j] = 0

is_bingo = False
for i in range(3):
    if np.sum(A[i, :]) == 0:
        is_bingo = True

for j in range(3):
    if np.sum(A[:, j]) == 0:
        is_bingo = True

if A[1, 1] == 0:
    if A[0, 0] == 0 and A[2, 2] == 0:
        is_bingo = True
    elif A[0, 2] == 0 and A[2, 0] == 0:
        is_bingo = True

if is_bingo:
    print("Yes")
else:
    print("No")

Solution (Python):
A=[list(map(int,input().split())) for i in range(3)]
A1=list(zip(*A))
A2=[A[0][0], A[1][1], A[2][2]]
A3=[A[2][0], A[1][1], A[0][2]]
N=int(input())
b=[int(input()) for i in range(N)]

count=0
for i in range(3):
  for j in range(3):
    if A[i][j] in b:
      count+=1
  if count==3:
    print('Yes')
    exit()
  else:
    count=0

for i in range(3):
  for j in range(3):
    if A1[i][j] in b:
      count+=1
  if count==3:
    print('Yes')
    exit()
  else:
    count=0

for i in range(3):
  if A2[i] in b:
    count+=1
if count==3:
  print('Yes')
  exit()
else:
  count=0
  
for i in range(3):
  if A3[i] in b:
    count+=1
if count==3:
  print('Yes')
else:
  print('No')

Solution (Python):
import numpy as np

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

a = np.array(a)
b = np.array(b)
  
for i in range(n) :
  num = b[i]
  for j in range(3) :
    for k in range(3) :
      if num == a[j][k] :
        a[j][k] = 0
        break
        
ans = 'No'
for i in range(3) :
  if all(j==0 for j in a[:,i]) or all(j==0 for j in a[i,:]) :
    ans = 'Yes'
    
af = np.fliplr(a)
if all(j==0 for j in np.diag(a)) or all(j==0 for j in np.diag(af)) :
  ans = 'Yes'

print(ans)

Solution (Python):
data = [list(map(int,input().split())) for _ in range(3)]

N = int(input())
for _ in range(N):
    bn = int(input())
    for i in range(3):
        for j in range(3):
            if bn == data[i][j]:
                data[i][j] = 0
ans = "No"
for i in range(3):
    if data[i][0] == data[i][1] == data[i][2] == 0:ans = "Yes"
    if data[0][i] == data[1][i] == data[2][i] == 0:ans = "Yes"
if data[0][0] == data[1][1] == data[2][2]==0:ans ="Yes"
if data[0][2] == data[1][1] == data[2][0] == 0 :ans="Yes"
print(ans)

Solution (Python):
A = [list(map(int,input().split())) for i in range(3)]
A = sum(A,[])
N = int(input())
flag = 0
for i in range(N):
    b = int(input())
    for j in range(9):
        if A[j] == b:
            A[j] = 0

for i in range(3):
    if A[i]==A[i+3] and A[i+3]==A[i+6] and A[i]==0 or\
        A[i*3] == A[i*3+1] and A[i*3+1] == A[i*3+2] and A[i*3] == 0:
        flag = 1
if A[0]==A[4] and A[4]==A[8] and A[0]==0 or\
     A[2]==A[4] and A[4]==A[6] and A[2]==0:
     flag = 1

if flag == 1:
    print("Yes")
else:
    print("No")

Solution (Python):
card = {}
bingo = {1:False,2:False,3:False,4:False,5:False,6:False,7:False,8:False,9:False}
for i in range(3):
    row = list(map(int, input().split()))
    card[i * 3 + 1] = row[0]
    card[i * 3 + 2] = row[1]
    card[i * 3 + 3] = row[2]

n = int(input())
for i in range(n):
    num = int(input())
    keys = [k for k, v in card.items() if v == num]
    if len(keys) > 0:
        bingo[keys[0]] = True

hit_keys = [k for k, v in bingo.items() if v]
if len(hit_keys) >= 3 and ((1 in hit_keys and 2 in hit_keys and 3 in hit_keys) or \
    (4 in hit_keys and 5 in hit_keys and 6 in hit_keys) or\
    (7 in hit_keys and 8 in hit_keys and 9 in hit_keys) or\
    (1 in hit_keys and 4 in hit_keys and 7 in hit_keys) or\
    (2 in hit_keys and 5 in hit_keys and 8 in hit_keys) or\
    (3 in hit_keys and 6 in hit_keys and 9 in hit_keys) or\
    (1 in hit_keys and 5 in hit_keys and 9 in hit_keys) or\
    (3 in hit_keys and 5 in hit_keys and 7 in hit_keys)):
    print("Yes")
else:
    print("No")

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

bingo=[[0,0,0],[0,0,0],[0,0,0]]
for i in num:
    for j in range(3):
        for k in range(3):
            if i==A[j][k]:
                bingo[j][k]=1

for i in range(3):
    if sum(bingo[i])==3:
        print("Yes")
        exit()

if bingo[0][0]+bingo[1][0]+bingo[2][0]==3 or bingo[0][1]+bingo[1][1]+bingo[2][1]==3 or bingo[0][2]+bingo[1][2]+bingo[2][2]==3:
        print("Yes")
        exit()

elif bingo[0][0]+bingo[1][1]+bingo[2][2]==3 or bingo[0][2]+bingo[1][1]+bingo[2][0]==3:
    print("Yes")
    exit()
    
print("No")

Solution (Python):
A = [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(3):
    if A[i][0] in b and A[i][1] in b and A[i][2] in b:
        print('Yes')
        exit()
    elif A[0][i] in b and A[1][i] in b and A[2][i] in b:
        print('Yes')
        exit()
if (A[0][0] in b and A[1][1] in b and A[2][2] in b) or (A[0][2] in b and A[1][1] in b and A[2][0] in b):
    print('Yes')
    exit()

print('No')

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



for i in range(3):
    for j in range(3):
        if (A[i][j] in B):
            A[i][j] = True
        else:
            A[i][j] = False


for i in range(3):
    if A[i][0] and A[i][1] and A[i][2]:
        print("Yes")
        exit()

    if A[0][i] and A[1][i] and A[2][i]:
        print("Yes")
        exit()

if A[0][0] and A[1][1]and A[2][2]:
    print("Yes")
    exit()

if A[2][0] and A[1][1] and A[0][2]:
    print("Yes")
    exit()

print("No")

Solution (Python):
import sys

bng=[[0]*3 for i in range(3)]

for i in range(3):

  a,b,c=map(int,input().split())

  bng[i][0]=a
  bng[i][1]=b
  bng[i][2]=c

n=int(input())

for j in range(n):

  k=int(input())

  for a in range(3):
    for b in range(3):
      if bng[a][b]==k:
        bng[a][b]=-1

for i in range(3):
  if bng[i][0]==-1 and bng[i][1]==-1 and bng[i][2]==-1:
    print("Yes")
    sys.exit()

  if bng[0][i]==-1 and bng[1][i]==-1 and bng[2][i]==-1:
    print("Yes")
    sys.exit()

if bng[0][0]==-1 and bng[1][1]==-1 and bng[2][2]==-1:
  print("Yes")
  sys.exit()

if bng[2][0]==-1 and bng[1][1]==-1 and bng[0][2]==-1:
  print("Yes")
  sys.exit()

print("No")

Solution (Python):
A=[list(map(int,input().split())) for _ in range(3)]
N=int(input())
b=[int(input()) for _ in range(N)]
flag=0
for i in range(3):
  if (A[0][i] in b)and(A[1][i] in b)and(A[2][i] in b):
    flag=1
  elif (A[i][0] in b)and(A[i][1] in b)and(A[i][2] in b):
    flag=1
if (A[0][0] in b)and(A[1][1] in b)and(A[2][2] in b):
  flag=1
elif (A[0][2] in b)and(A[1][1] in b)and(A[2][0] in b):
  flag=1
print("Yes" if flag==1 else "No")

Solution (Python):
A11, A12, A13 = map(int, input().split())
A21, A22, A23 = map(int, input().split())
A31, A32, A33 = map(int, input().split())
A = [A11, A12, A13, A21, A22, A23, A31, A32, A33]
N = int(input())
for _ in range(N):
  b = int(input())
  if b in A:
    A[A.index(b)] = 0

if A[0]==0 and A[1]==0 and A[2]==0:
  print("Yes")
elif A[3]==0 and A[4]==0 and A[5]==0:
  print("Yes")
elif A[6]==0 and A[7]==0 and A[8]==0:
  print("Yes")
elif A[0]==0 and A[3]==0 and A[6]==0:
  print("Yes")
elif A[1]==0 and A[4]==0 and A[7]==0:
  print("Yes")
elif A[2]==0 and A[5]==0 and A[8]==0:
  print("Yes")
elif A[0]==0 and A[4]==0 and A[8]==0:
  print("Yes")
elif A[2]==0 and A[4]==0 and A[6]==0:
  print("Yes")
else:
  print("No")

Solution (Python):
A1 = list(input().split())
A2 = list(input().split())
A3 = list(input().split())
A = [A1,A2,A3]
N = int(input())
for i in range(N):
  C = input()
  for j in range(3):
    if C == A[0][j]:
      A[0][j] = 'AC'
    if C == A[1][j]:
      A[1][j] = 'AC'
    if C == A[2][j]:
      A[2][j] = 'AC'
for l in range(3):
    if A[l][0] == A[l][1] == A[l][2] == 'AC':
      print('Yes')
      exit()
    if A[0][l] == A[1][l] == A[2][l] == 'AC':
      print('Yes')
      exit()
if A[0][0] == A[1][1] == A[2][2] == 'AC':
  print('Yes')
  exit()
if A[0][2] == A[1][1] == A[2][0] == 'AC':
  print('Yes')
  exit()
print('No')

Solution (Python):


A = [list(map(int, input().split())) for a 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

is_bingo = False
is_bingo = is_bingo or (A[0][0] == -1 and A[0][1] == -1 and A[0][2] == -1)
is_bingo = is_bingo or (A[1][0] == -1 and A[1][1] == -1 and A[1][2] == -1)
is_bingo = is_bingo or (A[2][0] == -1 and A[2][1] == -1 and A[2][2] == -1)
is_bingo = is_bingo or (A[0][0] == -1 and A[1][0] == -1 and A[2][0] == -1)
is_bingo = is_bingo or (A[0][1] == -1 and A[1][1] == -1 and A[2][1] == -1)
is_bingo = is_bingo or (A[0][2] == -1 and A[1][2] == -1 and A[2][2] == -1)
is_bingo = is_bingo or (A[0][0] == -1 and A[1][1] == -1 and A[2][2] == -1)
is_bingo = is_bingo or (A[0][2] == -1 and A[1][1] == -1 and A[2][0] == -1)

if is_bingo:
    print('Yes')
else:
    print('No')

Solution (Python):
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
N=int(input())
b=[int(input()) for i in range(N)]
if A1[0] in b and A2[0] in b and A3[0] in b:
    print('Yes')
    exit()
elif A1[1] in b and A2[1] in b and A3[1] in b:
    print('Yes')
    exit()
elif A1[2] in b and A2[2] in b and A3[2] in b:
    print('Yes')
    exit()
elif A1[0] in b and A1[1] in b and A1[2] in b:
    print('Yes')
    exit()
elif A2[0] in b and A2[1] in b and A2[2] in b:
    print('Yes')
    exit()
elif A3[0] in b and A3[1] in b and A3[2] in b:
    print('Yes')
    exit()
elif A1[0] in b and A2[1] in b and A3[2] in b:
    print('Yes')
    exit()
elif A1[2] in b and A2[1] in b and A3[0] in b:
    print('Yes')
    exit()
else:
    print('No')

Solution (Python):
A = []
for i in range(3):
    A += list(map(int, input().split()))
N = int(input())
for i in range(N):
    b = int(input())
    if b in A:
        A = [0 if num == b else num for num in A]
bingo_check = [[0, 1, 2],
               [0, 3, 6],
               [0, 4, 8],
               [1, 4, 7],
               [2, 4, 6],
               [2, 5, 8],
               [3, 4, 5],
               [6, 7, 8]]
no_check = 1
for check in bingo_check:
    row = [A[i] for i in check]
    if not sum(row):
        print("Yes")
        no_check = 0
        break
if no_check:
    print("No")

Solution (Python):
import numpy as np
S = np.array([list(map(int, input().split())) for _ in range(3)])
n = int(input())
for _ in range(n):
    S = np.where(S==int(input()), 0, S)
    HBingo = min(np.sum(S, axis=0)) == 0
    WBingo = min(np.sum(S, axis=1)) == 0
    SBingo = S[2][0] == 0 and S[1][1] == 0 and S[0][2] == 0
    BSBingo = S[0][0] == 0 and S[1][1] == 0 and S[2][2] == 0
if HBingo or WBingo or SBingo or BSBingo:
    print('Yes')
    exit()
print('No')

Solution (Python):
def columnCheck(a):
  result = False
  for i in a:
    if i == [0, 0, 0]:
      result = True
  return result

def rowCheck(a):
  result = False
  for j in range(3):
    if a[0][j] == 0 and a[1][j] == 0 and a[2][j] == 0:
      result = True
  return result

def crossCheck(a):
  result = False
  if a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0:
    result = True
  if a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0:
    result = True
  return result

a = []
for i in range(3):
  a.append([int(i) for i in input().split(" ")])
n = int(input())
b = []
for i in range(n):
  b.append(int(input()))

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

print("Yes" if columnCheck(a) or rowCheck(a) or crossCheck(a) else "No")

Solution (Python):
import numpy as np
S = np.array([list(map(int, input().split())) for _ in range(3)])
n = int(input())
for _ in range(n):
    S = np.where(S==int(input()), 0, S)
if min(np.sum(S, axis=0))==0 or min(np.sum(S, axis=1))==0:
    print('Yes')
    exit()
if (S[0][0] == 0 and S[1][1] == 0 and S[2][2] == 0) or (S[2][0] == 0 and S[1][1] == 0 and S[0][2] == 0):
    print('Yes')
    exit()
print('No')

Solution (Python):
a = []
c = [[0]*3 for i in range(3)]
for i in range(3):
    tmp = list(map(int,input().split()))
    a.append(tmp)
n = int(input())
b = []
for i in range(n):
    b.append(int(input()))
for i in b:
    for j in range(3):
        for k in range(3):
            if a[j][k] == i:
                c[j][k] = 1
if (c[0][0] == 1 and c[1][1] == 1 and c[2][2] == 1
    or c[2][0] == 1 and c[1][1] == 1 and c[0][2] == 1
    or c[0][0] == 1 and c[0][1] == 1 and c[0][2] == 1
    or c[1][0] == 1 and c[1][1] == 1 and c[1][2] == 1
    or c[2][0] == 1 and c[2][1] == 1 and c[2][2] == 1
    or c[0][0] == 1 and c[1][0] == 1 and c[2][0] == 1
    or c[0][1] == 1 and c[1][1] == 1 and c[2][1] == 1
    or c[0][2] == 1 and c[1][2] == 1 and c[2][2] == 1):
    print("Yes")
else:
    print("No")

Solution (Python):
A = []

for _ in range(3):
  A.append(list(map(int, input().strip().split())))


N = int(input())
nums = set()
for _ in range(N):
  n = int(input())
  nums.add(n)

for row in A:
  if len(set(row).difference(nums)) == 0:
    print('Yes')
    exit()
for col in range(len(A[0])):
  nums_in_col = set()
  for row in range(len(A)):
    nums_in_col.add(A[row][col])
  if len(nums_in_col.difference(nums)) == 0:
    print('Yes')
    exit()

nums_ = set()
for i in range(len(A)):
  nums_.add(A[i][i])
if len(nums_.difference(nums)) == 0:
  print('Yes')
  exit()

nums_ = set()
for i, j in zip(range(len(A)-1, -1, -1), range(len(A))):
  nums_.add(A[i][j])

if len(nums_.difference(nums)) == 0:
  print('Yes')
  exit()

print('No')

Solution (Python):
a = []
[a.append(list(map(int, input().split()))) 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 a[j][k] == i:
        a[j][k] = 1
ans = 0
count =0
for j in range(3):
  if a[j].count(1) == 3:
    ans += 1
  elif (a[0][j] == a[1][j] == a[2][j]) == 1:
    ans += 1
  elif (a[0][0] == a[1][1] == a[2][2]) == 1:
    ans += 1
  elif (a[0][2] == a[1][1] == a[2][0]) == 1:
    ans += 1
if ans > 0:
  print("Yes")
else:
  print("No")

Solution (Python):
bingoboard = list()
for x in range(3):
    bingoboard.append([int(x) for x in input().split()])
trials = int(input())

for t in range(trials):
    bingno = int(input())
    for i in range(3):
        for j in range(3):
            if bingno == bingoboard[i][j]:
                bingoboard[i][j] = 0

bingoBool = False
diag = 0
diag2 = 0
for i in range(3):
    col= 0
    row = 0
    for j in range(3):
        row += bingoboard[i][j]
        col += bingoboard[j][i]
        diag += bingoboard[i][i]
        diag2 += bingoboard[i][2-i]
    if row == 0 or col == 0:
        bingoBool = True
        break

if diag == 0 or diag2 == 0:
    bingoBool = True

if bingoBool:
    print("Yes")
else:
    print("No")

Solution (Python):
A = []
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))
A.append(list(map(int, input().split())))

N = int(input())
B = []
for _ in range(N):
  B.append(int(input()))
  

flg = False

for i in range(3):
  if A[i][0] in B and A[i][1] in B and A[i][2] in B:
    flg = True
  if A[0][i] in B and A[1][i] in B and A[2][i] in B:
    flg = True
  
if A[0][0] in B and A[1][1] in B and A[2][2] in B:
  flg = True
if A[2][0] in B and A[1][1] in B and A[0][2] in B:
  flg = True
  
print("Yes" if flg else "No")

Solution (Python):
al=list(map(int,input().split()))+list(map(int,input().split()))+list(map(int,input().split()))
n=int(input())
bl=[int(input()) for _ in [0]*n]
for i in bl:
  for j in range(9):
    if al[j] == i:
      al[j] = 0
nobingo = (al[0]+al[1]+al[2])*(al[3]+al[4]+al[5])*(al[6]+al[7]+al[8])*(al[0]+al[3]+al[6])*(al[1]+al[4]+al[7])*(al[2]+al[5]+al[8])*(al[0]+al[4]+al[8])*(al[2]+al[4]+al[6])
if nobingo:
  print('No')
else:
  print('Yes')