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):
def findnum(b):
    for i in range(len(Aone)):
        if(Aone[i] == b):
            Aone[i] = 0
    for i in range(len(Atwo)):
        if(Atwo[i] == b):
            Atwo[i] = 0
    for i in range(len(Athree)):
        if(Athree[i] == b):
            Athree[i] = 0

Aone = [int(a) for a in input().split()]
Atwo = [int(a) for a in input().split()]
Athree = [int(a) for a in input().split()]
N = int(input())

for i in range(N):
    b = int(input())
    findnum(b)

if(sum(Aone)*sum(Atwo)*sum(Athree)==0):
    print("Yes")
    exit()
for i in range(3):
    if(Aone[i]+Atwo[i]+Athree[i] == 0):
        print("Yes")
        exit()
if((Aone[0]+Atwo[1]+Athree[2])*(Aone[2]+Atwo[1]+Athree[0]) == 0):
    print("Yes")
    exit()

print("No")

Solution (Python):
A = [[0 for i in range(3)] for i in range(3)]

A[0] = list(map(int, input().split()))
A[1] = list(map(int, input().split()))
A[2] = list(map(int, input().split()))

N = int(input())

b = [0 for i in range(9)]

for i in range(N):
    b_in = int(input())

    for a in range(3):
        for aa in range(3):
            tmp = A[a][aa]
            
            if (b_in == tmp):
                index = 3 * a + aa
                b[index] += 1

b_judge = []
b_judge.append(sum(b[0:3]))
b_judge.append(sum(b[3:6]))
b_judge.append(sum(b[6:9]))
b_judge.append(b[0] + b[3] + b[6])
b_judge.append(b[1] + b[4] + b[7])
b_judge.append(b[2] + b[5] + b[8])
b_judge.append(b[0] + b[4] + b[8])
b_judge.append(b[2] + b[4] + b[6])

if (3 in b_judge):
    print('Yes')
else:
    print('No')

Solution (Python):
a = [input().split() for l in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
ans = 'No'
for i in range(3):
  for j in range(3):
    for k in range(n):
      a[i][j] = int(a[i][j])
      if a[i][j] == b[k]:
        a[i][j] = 1
if a[0][0] * a[0][1] * a[0][2] == 1:
  ans = 'Yes'
if a[1][0] * a[1][1] * a[1][2] == 1:
  ans = 'Yes'
if a[2][0] * a[2][1] * a[2][2] == 1:
	ans = 'Yes'
if a[0][0] * a[1][0] * a[2][0] == 1:
  ans = 'Yes'
if a[0][1] * a[1][1] * a[2][1] == 1:
  ans = 'Yes'
if a[0][2] * a[1][2] * a[2][2] == 1:
  ans = 'Yes'
if a[0][0] * a[1][1] * a[2][2] == 1:
  ans = 'Yes'
if a[2][0] * a[1][1] * a[0][2] == 1:
  ans = 'Yes'
print(ans)

Solution (Python):
A = [[],[],[]]
b = []

for i in range(0,3):
    A[i] = [int(x) for x in input().split(" ")]
N = int(input())
for i in range(0,N):
  b.append(int(input()))

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

if A[0] == [0,0,0] or A[1] == [0,0,0] or A[2] == [0,0,0]:
  print("Yes")
elif [A[0][0],A[1][0],A[2][0]] == [0,0,0]:
  print("Yes")
elif [A[0][1],A[1][1],A[2][1]] == [0,0,0]:
  print("Yes")
elif [A[0][2],A[1][2],A[2][2]] == [0,0,0]:
  print("Yes")
elif [A[0][0],A[1][1],A[2][2]] == [0,0,0]:
  print("Yes")
elif [A[2][0],A[1][1],A[0][2]] == [0,0,0]:
  print("Yes")
else:
  print("No")

Solution (Python):
row1 = list(map(int,input().split()))
row2 = list(map(int,input().split()))
row3 = list(map(int,input().split()))
n = int(input())
arr = []
for i in range(n):
    temp = int(input())
    arr.append(temp)
    
if row1[0] in arr and row1[1] in arr and row1[2] in arr or row2[0] in arr and row2[1] in arr and row2[2] in arr or row3[0] in arr and row3[1] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[0] in arr and row3[0] in arr or row1[1] in arr and row2[1] in arr and row3[1] in arr or row1[2] in arr and row2[2] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[1] in arr and row3[2] in arr or row1[2] in arr and row2[1] in arr and row3[0] in arr:
    print("Yes")
    exit()
else:
    print("No")

Solution (Python):
card = [[],[],[]]

row1=input().split()
row2=input().split()
row3=input().split()

for i in range(3):
  card[0].append(row1[i])
for i in range(3):
  card[1].append(row2[i])
for i in range(3):
  card[2].append(row3[i])
  
n = int(input())
b=[]
bingo = [[],[],[]]
for i in range(3):
  for j in range(3):
    bingo[i].append(None)
for k in range(n):
  t = input()
  b.append(t)
  for i in range(3):
    for j in range(3):
      if t == card[i][j]:
        bingo[i][j] = True
  
flag = "No"
if bingo[0][0] and bingo[1][0] and bingo[2][0]:
  flag = "Yes"
if bingo[0][1] and bingo[1][1] and bingo[2][1]:
  flag = "Yes"
if bingo[0][2] and bingo[1][2] and bingo[2][2]:
  flag = "Yes"
  
if bingo[0][0] and bingo[0][1] and bingo[0][2]:
  flag = "Yes"
if bingo[1][0] and bingo[1][1] and bingo[1][2]:
  flag = "Yes"
if bingo[2][0] and bingo[2][1] and bingo[2][2]:
  flag = "Yes"

if bingo[0][0] and bingo[1][1] and bingo[2][2]:
  flag = "Yes"
if bingo[0][2] and bingo[1][1] and bingo[2][0]:
  flag = "Yes"
  
print(flag)

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

X = [
    set(A[0]),
    set(A[1]),
    set(A[2]),
    set([A[0][0], A[1][0], A[2][0]]),
    set([A[0][1], A[1][1], A[2][1]]),
    set([A[0][2], A[1][2], A[2][2]]),
    set([A[0][0], A[1][1], A[2][2]]),
    set([A[0][2], A[1][1], A[2][0]]),
]

for x in X:
    if x <= B:
        print('Yes')
        exit()

print('No')

Solution (Python):
al = list(list(map(int, input().split())) for _ in range(3))
n = int(input())
bl = list(int(input()) for _ in range(n))

bingo = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]









for i in range(3):
    for j in range(3):
        if bl.count(al[i][j]) > 0:
            bingo[i][j] = 1

for b in bingo:
    if b.count(1) == 3:
        print('Yes')
        exit()



for i in range(3):
    if bingo[0][i] == 1 and bingo[1][i] == 1 and bingo [2][i] == 1:
        print('Yes')
        exit()

if bingo[0][0] == 1 and bingo[1][1] == 1 and bingo[2][2] == 1:
    print('Yes')
    exit()

if bingo[0][2] == 1 and bingo[1][1] == 1 and bingo[2][0] ==1:
    print('Yes')
    exit()

print('No')

Solution (Python):
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
row = int(input())
detame = [int(input()) for i in range(row)]
bingo = 0
if (a1[0]) in detame and (a1[1]) in detame and (a1[2]) in detame:
    bingo=bingo+1
elif (a2[0]) in detame and (a2[1]) in detame and (a2[2]) in detame:
    bingo=bingo+1
elif (a3[0]) in detame and (a3[1]) in detame and (a3[2]) in detame:
    bingo=bingo+1
elif (a1[0]) in detame and (a2[0]) in detame and (a3[0]) in detame:
    bingo=bingo+1
elif (a1[1]) in detame and (a2[1]) in detame and (a3[1]) in detame:
    bingo=bingo+1
elif (a1[2]) in detame and (a2[2]) in detame and (a3[2]) in detame:
    bingo=bingo+1
elif (a1[0]) in detame and (a2[1]) in detame and (a3[2]) in detame:
    bingo=bingo+1
elif (a1[2]) in detame and (a2[1]) in detame and (a3[0]) in detame:
    bingo=bingo+1
if bingo==0:
    print("No")
else:
    print("Yes")

Solution (Python):
import sys

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

n = int(input())
b = [int(input()) for _ in range(n)]

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

for i in range(3):
   x = 0
   for j in range(3):
      x += a[j][i]
   if (x == 0):
      print('Yes')
      sys.exit()

tmp = [sum(a[i]) for i in range(3)]
if (min(tmp) == 0):
   print('Yes')
elif (a[0][0] + a[1][1] + a[2][2] == 0):
   print('Yes')
elif (a[0][2] + a[1][1] + a[2][0] == 0):
   print('Yes')
else:
   print('No')

Solution (Python):
import sys
input = sys.stdin.readline
 
def main():
    bingo_map = [[0] * 3 for _ in range(3)]
    number_list = []
    for _ in range(3):
        A, B, C = map(int, input().split())
        number_list.append(A)
        number_list.append(B)
        number_list.append(C)
    N = int(input())
    for _ in range(N):
        b = int(input())
        if b in number_list:
            pos = number_list.index(b)
            bingo_map[pos//3][pos%3] = 1
        else:
            continue
    nagomi = bingo_map[0][0] + bingo_map[1][1] + bingo_map[2][2]
    kugoi  = bingo_map[0][2] + bingo_map[1][1] + bingo_map[2][0]
    nahaku = bingo_map[0][0] + bingo_map[0][1] + bingo_map[0][2]
    shigoro = bingo_map[1][0] + bingo_map[1][1] + bingo_map[1][2]
    hifumi = bingo_map[2][0] + bingo_map[2][1] + bingo_map[2][2]
    nashii = bingo_map[0][0] + bingo_map[1][0] + bingo_map[2][0]
    yagoni = bingo_map[0][1] + bingo_map[1][1] + bingo_map[2][1]
    kuromi = bingo_map[0][2] + bingo_map[1][2] + bingo_map[2][2]
    if nagomi == 3 or kugoi == 3 or nahaku == 3 or shigoro == 3 or hifumi == 3 or nashii == 3 or yagoni == 3 or kuromi == 3:
        print("Yes")
    else:
        print("No")
 
 
if __name__ == "__main__":
    main()

Solution (Python):
ans = 'No'
A = []
for _ in range(3):
    A.append([int(n) for n in input().split()])
N = int(input())
B = []
for i in range(N):
    B.append(int(input()))
for n in B:
    for i in range(3):
        for j in range(3):
            if A[i][j] == n:
                A[i][j] = 0
for a,b,c in zip(A[0], A[1], A[2]):
    if sum([a,b,c]) == 0:
        ans = 'Yes'
for i in range(3):
    if sum(A[i]) == 0:
        ans = 'Yes'
if sum([A[0][0], A[1][1], A[2][2]]) == 0:
    ans = 'Yes'
if sum([A[0][2], A[1][1], A[2][0]]) == 0:
    ans = 'Yes'
print(ans)

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


for i in range(3):  
  if A[i][0] in b:
    if A[i][1] in b:
      if A[i][2] in b:
        flag=True

for j in range(3):  
  if A[0][j] in b:
    if A[1][j] in b:
      if A[2][j] in b:
        flag=True      

if A[0][0] in b:
  if A[1][1] in b:
    if A[2][2] in b:
      flag=True

if A[0][2] in b:
  if A[1][1] in b:
    if A[2][0] in b:
      flag=True      

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

Solution (Python):
def resolve():
    a = []
    for _ in range(3):
        a.append(list(map(int, input().split())))
    n = int(input())
    b = []
    for _ in range(n):
        b.append(int(input()))

    check = [[False] * 3 for _ in range(3)]

    for b_one in b:
        for i in range(3):
            for j in range(3):
                if a[i][j] == b_one:
                    check[i][j] = True

    if check[0][0] and check[0][1] and check[0][2]:
        print('Yes')
        return
    if check[1][0] and check[1][1] and check[1][2]:
        print('Yes')
        return
    if check[2][0] and check[2][1] and check[2][2]:
        print('Yes')
        return
    if check[0][0] and check[1][0] and check[2][0]:
        print('Yes')
        return
    if check[0][1] and check[1][1] and check[2][1]:
        print('Yes')
        return
    if check[0][2] and check[1][2] and check[2][2]:
        print('Yes')
        return
    if check[0][0] and check[1][1] and check[2][2]:
        print('Yes')
        return
    if check[0][2] and check[1][1] and check[2][0]:
        print('Yes')
        return

    print('No')

resolve()

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())
b = [int(input()) for i in range(n)]
a = [a11,a12,a13,a21,a22,a23,a31,a32,a33]
A = []
a.sort()


for i in b:
    if i in a:
        A.append(i)
    else:
        pass
    
if a11 in A and a12 in A and a13 in A:
    print('Yes')
elif a21 in A and a22 in A and a23 in A:
    print('Yes')
elif a31 in A and a32 in A and a33 in A:
    print('Yes')
elif a11 in A and a21 in A and a31 in A:
    print('Yes')
elif a12 in A and a22 in A and a32 in A:
    print('Yes')
elif a13 in A and a23 in A and a33 in A:
    print('Yes')
elif a11 in A and a22 in A and a33 in A:
    print('Yes')
elif a13 in A and a22 in A and a31 in A:
    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())

b1 = [0,0,0]
b2 = [0,0,0]
b3 = [0,0,0]

for i in range(n):
    b = int(input())
    for j in range(3):
        if a1[j] == b:
            b1[j] = 1
        if a2[j] == b:
            b2[j] = 1
        if a3[j] == b:
            b3[j] = 1

if b1[0] == 1 and b1[1] == 1 and b1[2] == 1:
    print("Yes")
elif b2[0] == 1 and b2[1] == 1 and b2[2] == 1:
    print("Yes")
elif b3[0] == 1 and b3[1] == 1 and b3[2] == 1:
    print("Yes")
elif b1[0] == 1 and b2[0] == 1 and b3[0] == 1:
    print("Yes")
elif b1[1] == 1 and b2[1] == 1 and b3[1] == 1:
    print("Yes")
elif b1[2] == 1 and b2[2] == 1 and b3[2] == 1:
    print("Yes")
elif b1[0] == 1 and b2[1] == 1 and b3[2] == 1:
    print("Yes")
elif b1[2] == 1 and b2[1] == 1 and b3[0] == 1:
    print("Yes")
else:
    print("No")

Solution (Python):
row1 = list(map(int,input().split()))
row2 = list(map(int,input().split()))
row3 = list(map(int,input().split()))
n = int(input())
arr = []
for i in range(n):
    temp = int(input())
    arr.append(temp)

if row1[0] in arr and row1[1] in arr and row1[2] in arr or row2[0] in arr and row2[1] in arr and row2[2] in arr or row3[0] in arr and row3[1] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[0] in arr and row3[0] in arr or row1[1] in arr and row2[1] in arr and row3[1] in arr or row1[2] in arr and row2[2] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[1] in arr and row3[2] in arr or row1[2] in arr and row2[1] in arr and row3[0] in arr:
    print("Yes")
    exit()
else:
    print("No")

Solution (Python):
from sys import stdin,exit
import  numpy as np
A = [stdin.readline().rstrip().split() for _ in range(3)]
A=sum(A,[])
n = int(stdin.readline().rstrip())
B= [stdin.readline().rstrip().split() for _ in range(n)]
B=sum(B,[])
if len(B)<=2:
    print("No")
    sys.exit()
for i in range(len(B)):
    try:
        A[A.index(B[i])]=0
    except:
        continue
A=[int(i) for i in A]
if A[1]+A[2]+A[0]==0 or A[0]+A[3]+A[6]==0 or A[2]+A[4]+A[6]==0 or A[3]+A[4]+A[5]==0 or A[1]+A[4]+A[7]==0 or A[0]+A[4]+A[8]==0 or A[6]+A[7]+A[8]==0 or A[2]+A[5]+A[8]==0:
    print("Yes")
else:
    print("No")

Solution (Python):
li1 = list(map(int,input().split()))
li1.extend(list(map(int,input().split())))
li1.extend(list(map(int,input().split())))
n = int(input())
for i in range(n):
  p = int(input())
  li1 = [0 if j == p else j for j in li1]
if ( li1[0] + li1[1] + li1[2] ) == 0:
  print('Yes')
elif ( li1[3] + li1[4] + li1[5] ) == 0:
  print('Yes')
elif ( li1[6] + li1[7] + li1[8] ) == 0:
  print('Yes')
elif ( li1[0] + li1[3] + li1[6] ) == 0:
  print('Yes')
elif ( li1[1] + li1[4] + li1[7] ) == 0:
  print('Yes')
elif ( li1[2] + li1[5] + li1[8] ) == 0:
  print('Yes')
elif ( li1[0] + li1[4] + li1[8] ) == 0:
  print('Yes')
elif ( li1[2] + li1[4] + li1[6] ) == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
flatten_A = []

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

N = int(input())
B = [0] * N
for i in range(N):
    B[i] = int(input())


import itertools
def flatten_list(l):
    return list(itertools.chain.from_iterable(l))

mark_list = [False] * 9

flatten_A = flatten_list(flatten_A)
for b in B:
    if not b in flatten_A: continue
    
    for i in range(9):
        if flatten_A[i] == b:
            mark_list[i] = True

"""
[0, 1, 2], [3, 4, 5], [6, 7, 8]
[0, 3, 6], [1, 4, 7], [2, 5, 8]
[0, 4, 8], [2, 4, 6]
"""
def judge_bingo(l):
    yes = "Yes"
    no = "No"
    if l.count(True) < 3:
        return no
    if l[0]:
        if (l[1] and l[2]) or (l[3] and l[6]) or (l[4] and l[8]):
            return yes
    if l[3] and l[4] and l[5]:
        return yes
    if l[1] and l[4] and l[7]:
        return yes
    if l[2]:
        if l[4] and l[6]: return yes
        if l[5] and l[8]: return yes
    if l[6] and l[7] and l[8]:
        return yes
    return no
        

ans = judge_bingo(mark_list)
print(ans)

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

bingo = {
    data[0][0]: False, data[0][1]: False, data[0][2]: False,
    data[1][0]: False, data[1][1]: False, data[1][2]: False,
    data[2][0]: False, data[2][1]: False, data[2][2]: False,
}
n = int(input())

for i in range(0, n):
    number = int(input())
    if number in bingo:
        bingo[number] = True

result = False;
for i in range(0, 3):
    if bingo[data[i][0]] and bingo[data[i][1]] and bingo[data[i][2]]:
        result = True
    if bingo[data[0][i]] and bingo[data[1][i]] and bingo[data[2][i]]:
        result = True

if bingo[data[0][0]] and bingo[data[1][1]] and bingo[data[2][2]]:
    result = True

if bingo[data[0][2]] and bingo[data[1][1]] and bingo[data[2][0]]:
    result = True

if result:
    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 = []
for i in range(N):
    b.append(int(input()))
ans = "No"

if (A1[0] in b) and (A2[0] in b) and (A3[0] in b):
    ans = "Yes"
if (A1[1] in b) and (A2[1] in b) and (A3[1] in b):
    ans = "Yes"
if (A1[2] in b) and (A2[2] in b) and (A3[2] in b):
    ans = "Yes"
if (A1[0] in b) and (A2[1] in b) and (A3[2] in b):
    ans = "Yes"
if (A1[2] in b) and (A2[1] in b) and (A3[0] in b):
    ans = "Yes"
if (A1[0] in b) and (A1[1] in b) and (A1[2] in b):
    ans = "Yes"
if (A2[0] in b) and (A2[1] in b) and (A2[2] in b):
    ans = "Yes"
if (A3[0] in b) and (A3[1] in b) and (A3[2] in b):
    ans = "Yes"

print(ans)

Solution (Python):
A_1 = list(map(int,input().split()))
A_2 = list(map(int,input().split()))
A_3 = list(map(int,input().split()))
N = int(input())
b = []
save = []
count = 0
hantei1 = [[1,1],[2,2],[3,3]]
hantei2 = [[1,1],[1,2],[1,3]]
hantei3 = [[2,1],[2,2],[2,3]]
hantei4 = [[3,1],[3,2],[3,3]]
hantei5 = [[1,3],[2,2],[3,1]]
hantei6 = [[1,1],[2,1],[3,1]]
hantei7 = [[1,2],[2,2],[3,2]]
hantei8 = [[1,3],[2,3],[3,3]]
for i in range(N):
    b.append(int(input()))

for i in range(N):
    if b[i] in A_1:
        save.append([1,A_1.index(b[i])+1])
    if b[i] in A_2:
        save.append([2,A_2.index(b[i])+1])
    if b[i] in A_3:
        save.append([3,A_3.index(b[i])+1])


if hantei1[0] in save and hantei1[1] in save and hantei1[2] in save:
    count +=1
if hantei2[0] in save and hantei2[1] in save and hantei2[2] in save:
    count +=1
if hantei3[0] in save and hantei3[1] in save and hantei3[2] in save:
    count +=1
if hantei4[0] in save and hantei4[1] in save and hantei4[2] in save:
    count +=1
if hantei5[0] in save and hantei5[1] in save and hantei5[2] in save:
    count +=1
if hantei6[0] in save and hantei6[1] in save and hantei6[2] in save:
    count +=1
if hantei7[0] in save and hantei7[1] in save and hantei7[2] in save:
    count +=1
if hantei8[0] in save and hantei8[1] in save and hantei8[2] in save:
    count +=1

if count >= 1:
    print("Yes")
else:
    print("No")

Solution (Python):
row1 = list(map(int,input().split()))
row2 = list(map(int,input().split()))
row3 = list(map(int,input().split()))
n = int(input())
arr = []
for i in range(n):
    temp = int(input())
    arr.append(temp)

if row1[0] in arr and row1[1] in arr and row1[2] in arr or row2[0] in arr and row2[1] in arr and row2[2] in arr or row3[0] in arr and row3[1] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[0] in arr and row3[0] in arr or row1[1] in arr and row2[1] in arr and row3[1] in arr or row1[2] in arr and row2[2] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[1] in arr and row3[2] in arr or row1[2] in arr and row2[1] in arr and row3[0] in arr:
    print("Yes")
    exit()
else:
    print("No")

Solution (Python):
A_1 = input().split()
A_2 = input().split()
A_3 = input().split()

N = int(input())

B_list = []
for i in range(N):
    B = input()
    B_list.append(B)

ans = "No"

if A_1[0] in B_list:
    if A_2[0] in B_list and A_3[0] in B_list:
        ans = "Yes"
    elif A_1[1] in B_list and A_1[2] in B_list:
        ans = "Yes"
    elif A_2[1] in B_list and A_3[2] in B_list:
        ans = "Yes"

if A_1[1] in B_list and A_2[1] in B_list and A_3[1] in B_list:
    ans = "Yes"
elif A_1[2] in B_list and A_2[1] in B_list and A_3[0] in B_list:
    ans = "Yes"
elif A_1[2] in B_list and A_2[2] in B_list and A_3[2] in B_list:
    ans = "Yes"    
elif A_2[0] in B_list and A_2[1] in B_list and A_2[2] in B_list:
    ans = "Yes"
elif A_3[0] in B_list and A_3[1] in B_list and A_3[2] in B_list:
    ans = "Yes"

print(ans)

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())
l=[]
b=[a11,a12,a13,a21,a22,a23,a31,a32,a33]
for i in range(n):
  m=int(input())
  for j in range(9):
    if m==b[j]:
      b[j]=0
if b[0]==0 and b[1]==0 and b[2]==0:
  print('Yes')
elif b[3]==0 and b[4]==0 and b[5]==0:
  print('Yes')
elif b[6]==0 and b[7]==0 and b[8]==0:
  print('Yes')
elif b[0]==0 and b[3]==0 and b[6]==0:
  print('Yes')
elif b[1]==0 and b[4]==0 and b[7]==0:
  print('Yes')
elif b[2]==0 and b[5]==0 and b[8]==0:
  print('Yes')
elif b[0]==0 and b[4]==0 and b[8]==0:
  print('Yes')
elif b[2]==0 and b[4]==0 and b[6]==0:
  print('Yes')
else:
  print('No')

Solution (Python):

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

Solution (Python):
s = list(map(int, input().split()))
t = list(map(int, input().split()))
u = list(map(int, input().split()))

bingo = [s, t, u]

n = int(input())
numbers = [int(input()) for _ in range(n)]

for i in range(3):
    for j in range(3):
        if bingo[i][j] in numbers:
            bingo[i][j] = 0

for i in range(3):
    if bingo[i][0] == 0 and bingo[i][1] == 0 and bingo[i][2] == 0:
        print('Yes')
        exit()

if (bingo[0][0] == 0 and bingo[1][1] == 0 and bingo[2][2] == 0) or \
        (bingo[0][2] == 0 and bingo[1][1] == 0 and bingo[2][0] == 0):
    print('Yes')
    exit()

for i in range(3):
    if bingo[0][i] == 0 and bingo[1][i] == 0 and bingo[2][i] == 0:
        print('Yes')
        exit()

print('No')

Solution (Python):
a=[]
a1 = list(map(int, input().split()))
a.append(a1)
a1 = list(map(int, input().split()))
a.append(a1)
a1 = list(map(int, input().split()))
a.append(a1)
N=int(input())
b = []
for _ in range(N):
    b.append(int(input()))

d=[[0,0,0],[0,0,0],[0,0,0]]
for k in range(N):
    for i in range(3):
        for j in range(3):
            if a[i][j]==b[k]:
                d[i][j]=1
c=[0]*8
for i in range(3):

    c[0]+=d[i][0]
    c[1] +=d[i][1]
    c[2] +=d[i][2]
    c[3] +=d[0][i]
    c[4] +=d[1][i]
    c[5] +=d[2][i]
    c[6] +=d[i][i]
    c[7] +=d[2-i][i]

if max(c)==3:
    print("Yes")
else:
    print("No")

Solution (Python):
row1 = list(map(int,input().split()))
row2 = list(map(int,input().split()))
row3 = list(map(int,input().split()))
n = int(input())
arr = []
for i in range(n):
    temp = int(input())
    arr.append(temp)

if row1[0] in arr and row1[1] in arr and row1[2] in arr or row2[0] in arr and row2[1] in arr and row2[2] in arr or row3[0] in arr and row3[1] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[0] in arr and row3[0] in arr or row1[1] in arr and row2[1] in arr and row3[1] in arr or row1[2] in arr and row2[2] in arr and row3[2] in arr:
    print("Yes")
    exit()
elif row1[0] in arr and row2[1] in arr and row3[2] in arr or row1[2] in arr and row2[1] in arr and row3[0] in arr:
    print("Yes")
    exit()
else:
    print("No")

Solution (Python):
A = tuple([tuple(map(int,input().split())) for i in range(3)])
N = int(input())
B = tuple([int(input()) for i in range(N)])
BINGO = [[False]*3 for i in range(3)]
for b in B:
    for y, line in enumerate(A):
        for x, a in enumerate(line):
            if a == b:
                BINGO[y][x] = True
def solve():
    for line in BINGO:
        if line == [True, True, True]:
            return "Yes"
    if BINGO[0][0] == True and BINGO[1][0] == True and BINGO[2][0] == True:
        return "Yes"
    if BINGO[0][1] == True and BINGO[1][1] == True and BINGO[2][1] == True:
        return "Yes"
    if BINGO[0][2] == True and BINGO[1][2] == True and BINGO[2][2] == True:
        return "Yes"
    if BINGO[0][0] == True and BINGO[1][1] == True and BINGO[2][2] == True:
        return "Yes"
    if BINGO[0][2] == True and BINGO[1][1] == True and BINGO[2][0] == True:
        return "Yes"
    return 'No'        
print(solve())

Solution (Python):
import sys

card = []
for i in range(3):
    card.append([int(x) for x in input().split()])

N = int(input())
numbers = set()
for i in range(N):
    numbers.add(int(input()))


def checker(aa):
    if len(aa) == 1 and 'x' in aa:
        print('Yes')
        sys.exit()


for i in range(3):
    for j in range(3):
        if card[i][j] in numbers:
            card[i][j] = 'x'


for row in card:
    s = set()
    for col in row:
        s.add(col)
    checker(s)


for i in range(3):
    s = set()
    for j in range(3):
        s.add(card[j][i])
    checker(s)

s = set()
for i in range(3):
    s.add(card[i][i])
checker(s)

a = set()
a.add(card[0][2])
a.add(card[1][1])
a.add(card[2][0])
checker(a)


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())
for i in range(n):
  a = int(input())
  if a in A1:
    A1[A1.index(a)] = 0
  if a in A2:
    A2[A2.index(a)] = 0
  if a in A3:
    A3[A3.index(a)] = 0

if sum(A1)==0:
  print("Yes")
elif sum(A2)==0:
  print("Yes")
elif sum(A3)==0:
  print("Yes")
elif A1[0]+A2[0]+A3[0]==0:
  print("Yes")
elif A1[1]+A2[1]+A3[1]==0:
  print("Yes")
elif A1[2]+A2[2]+A3[2]==0:
  print("Yes")
elif A1[0]+A2[1]+A3[2]==0:
  print("Yes")
elif A1[2]+A2[1]+A3[0]==0:
  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())
for i in range(n):
    b=int(input())
    for j in range(3):
        if a1[j]==b:
            a1[j]=0
        if a2[j]==b:
            a2[j]=0
        if a3[j]==b:
            a3[j]=0
answer='No'
if a1.count(0)==3 or a2.count(0)==3 or a3.count(0)==3:
    answer='Yes'
elif a1[0]==0 and a2[0]==0 and a3[0]==0:
    answer='Yes'
elif a1[1]==0 and a2[1]==0 and a3[1]==0:
    answer='Yes'
elif a1[2]==0 and a2[2]==0 and a3[2]==0:
    answer='Yes'
elif a1[0]==0 and a2[1]==0 and a3[2]==0:
    answer='Yes'
elif a1[2]==0 and a2[1]==0 and a3[0]==0:
    answer='Yes'
print(answer)

Solution (Python):
A_1 = list(map(int, input().split()))
A_2 = list(map(int, input().split()))
A_3 = list(map(int, input().split()))
A = A_1 + A_2 + A_3
N = int(input())
B = []
for _ in range(N):
  B.append(int(input()))
for b in range(N):
  for a in range(9):
    if B[b] == A[a]:
      A[a] = 0
BINGO = 'No'
for i in range(3):
  if A[i*3] + A[i*3+1] + A[i*3+2] == 0:
    BINGO = 'Yes'
  if A[i] + A[i+3] + A[i+6] == 0:
      BINGO = 'Yes'
if (A[0] + A[4] + A[8] == 0):
  BINGO = 'Yes'
if (A[2] + A[4] + A[6] == 0):
  BINGO = 'Yes'
print(BINGO)

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

c = [[-1,-1,-1],[-1,-1,-1],[-1,-1,-1]]

for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            c[i][j] = 1

ans = False

if c[0][0] == 1 and c[0][1] == 1 and c[0][2] == 1:
    ans = True
if c[1][0] == 1 and c[1][1] == 1 and c[1][2] == 1:
    ans = True
if c[2][0] == 1 and c[2][1] == 1 and c[2][2] == 1:
    ans = True
if c[0][0] == 1 and c[1][0] == 1 and c[2][0] == 1:
    ans = True
if c[0][1] == 1 and c[1][1] == 1 and c[2][1] == 1:
    ans = True
if c[0][2] == 1 and c[1][2] == 1 and c[2][2] == 1:
    ans = True
if c[0][0] == 1 and c[1][1] == 1 and c[2][2] == 1:
    ans = True
if c[2][0] == 1 and c[1][1] == 1 and c[0][2] == 1:
    ans = True

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

Solution (Python):
A1 = [0] * 3
A2 = [0] * 3
A3 = [0] * 3
for i in range(3):
    A1[i], A2[i], A3[i] = map(int, input().split())

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

for i in b:
    for j in range(3):
        if A1[j] == i:
            A1[j] = 'ok'
        elif A2[j] == i:
            A2[j] = 'ok'
        elif A3[j] == i:
            A3[j] = 'ok'


if A1[0] == A1[1] == A1[2]:
    print('Yes')

elif A2[0] == A2[1] == A2[2]:
    print('Yes')

elif A3[0] == A3[1] == A3[2]:
    print('Yes')

elif A1[0] == A2[1] == A3[2]:
    print('Yes')

elif A3[0] == A2[1] == A1[2]:
    print('Yes')

elif A1[0] == A2[0] == A3[0]:
    print('Yes')

elif A1[1] == A2[1] == A3[1]:
    print('Yes')

elif A1[2] == A2[2] == A3[2]:
    print('Yes')
    
else:
    print('No')

Solution (Python):
import numpy as np

card = np.array([list(map(int, input().split())) for i in range(3)])

n = int(input())

number = [int(input()) for i in range(n)]

hit = np.vectorize(lambda x: x in number)(card)

row = hit.all(axis=0).any()
col = hit.all(axis=1).any()

diag1 = hit[0][0] and hit[1][1] and hit[2][2]
diag2 = hit[0][2] and hit[1][1] and hit[2][0]

print('Yes' if row or col or diag1 or diag2 else 'No')

Solution (Python):
import numpy as np

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

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

if (A[:,0].sum()==0) or (A[:,1].sum()==0) or (A[:,2].sum()==0):
  print("Yes")
elif (A[0,:].sum()==0) or (A[1,:].sum()==0) or (A[2,:].sum()==0):
  print("Yes")
elif 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")