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: Wrong Answer

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

n = int(input())

k = [int(input()) for p in range(n)]
for s in a:
    if s[0] in k or s[1] in k or s[2] in k:
        print("Yes")
        exit()

for t in range(3):
    if a[0][t] in k and a[1][t] in k and a[2][t] in k:
        print("Yes")
        exit()

if a[0][0] in k and a[1][1] in k and a[2][2] in k:
    print("Yes")
    exit()

if a[0][2] in k and a[1][1] in k and a[2][0] in k:
    print("Yes")
    exit()

print("No")

Submission status: Wrong Answer

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

n = int(input())

k = [int(input()) for p in range(n)]
for s in a:
    if s[0] in k or s[1] in k or s[2] in k:
        print("Yes")
        exit()

for s in range(3):
    if a[0][s] in k or a[1][s] in k or a[2][s]:
        print("Yes")
        exit()

if a[0][0] in k and a[1][1] in k and a[2][2] in k:
    print("Yes")
    exit()

if a[0][2] in k and a[1][1] in k and a[2][0] in k:
    print("Yes")
    exit()

print("No")

Submission status: Wrong Answer

Solution code:
a0,a1,a2=map(int,input().split())
a3,a4,a5=map(int,input().split())
a6,a7,a8=map(int,input().split())
N=int(input())
b=[input() for i in range(N)]

c=range(9)
lists=[]
lists.append(a0)
lists.append(a1)
lists.append(a2)
lists.append(a3)
lists.append(a4)
lists.append(a5)
lists.append(a6)
lists.append(a7)
lists.append(a8)

listb=[]
for j in range(N):
  listb.append(b[j])

for il in c:
    for ib in range(N):
        if b[ib]==lists[il]:
            k=il
            lists[k]=0
            
if lists[0]==lists[1] and lists[2]==lists[1] and lists[0]==0:
    print ('Yes')
elif lists[3]==lists[4] and lists[5]==lists[4] and lists[3]==0:
    print ('Yes')
elif lists[6]==lists[7] and lists[8]==lists[7] and lists[6]==0:
    print ('Yes')
elif lists[0]==lists[3] and lists[3]==lists[6] and lists[0]==0:
    print ('Yes')
elif lists[1]==lists[4] and lists[4]==lists[7] and lists[1]==0:
    print ('Yes')
elif lists[2]==lists[5] and lists[5]==lists[8] and lists[2]==0:
    print ('Yes')
elif lists[0]==lists[4] and lists[4]==lists[8] and lists[0]==0:
    print ('Yes')
elif lists[2]==lists[4] and lists[4]==lists[6] and lists[2]==0:
    print ('Yes')
else:
    print ('No')

Submission status: Wrong Answer

Solution code:
a0,a1,a2=map(int,input().split())
a3,a4,a5=map(int,input().split())
a6,a7,a8=map(int,input().split())
N=int(input())
b=[input() for i in range(N)]

c=range(9)
lists=[]
lists.append(a0)
lists.append(a1)
lists.append(a2)
lists.append(a3)
lists.append(a4)
lists.append(a5)
lists.append(a6)
lists.append(a7)
lists.append(a8)

listb=[]
for j in range(N):
  listb.append(b[j])

for il in c:
    for ib in range(N):
        if b[ib]==lists[il]:
            k=il
            lists[k]=0
            
if lists[0]==lists[1] and lists[2]==lists[1]:
    print ('Yes')
elif lists[3]==lists[4] and lists[5]==lists[4]:
    print ('Yes')
elif lists[6]==lists[7] and lists[8]==lists[7]:
    print ('Yes')
elif lists[0]==lists[3] and lists[3]==lists[6]:
    print ('Yes')
elif lists[1]==lists[4] and lists[4]==lists[7]:
    print ('Yes')
elif lists[2]==lists[5] and lists[5]==lists[8]:
    print ('Yes')
elif lists[0]==lists[4] and lists[4]==lists[8]:
    print ('Yes')
elif lists[2]==lists[4] and lists[4]==lists[6]:
    print ('Yes')
else:
    print ('No')

Submission status: Wrong Answer

Solution code:
n11, n12, n13 = map(int,input().split())
n21, n22, n23 = map(int,input().split())
n31, n32, n33 = map(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 = {}
r = input()
for i in range(int(r)):
  nums[input()] = 0
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("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n11, n12, n13 = map(int,input().split())
n21, n22, n23 = map(int,input().split())
n31, n32, n33 = map(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 = {}
r = input()
for i in range(int(r)):
  nums[input()] = 0
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: Wrong Answer

Solution code:
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
B = [list(map(int, input().split())) for i in range(N)]
c = [[0] * 3 for _ in range(3)]
for b in B:
  for i in range(3):
    for j in range(3):
      if A[i][j] == b:
        c[i][j] == 1
for i in range(3):
    if c[i][0] and c[i][1] and c[i][2]:
        print('Yes')
        exit()
    if c[0][i] and c[1][i] and c[2][i]:
        print('Yes')
        exit()
if c[0][0] and c[1][1] and c[2][2]:
    print('Yes')
    exit()
if c[0][2] and c[1][1] and c[2][0]:
    print('Yes')
    exit()
print('No')

Submission status: Wrong Answer

Solution code:

a,b,c = list(map(int, input().split()))
d,e,f = list(map(int, input().split()))	
g,h,k = list(map(int, input().split()))
N = int(input())
l = []
for i in range(N):
	e=int(input())
	l.append(e)
L1 = {a,d,g}
L2 = {a,b,c}
L3 = {a,e,k}
L4 = {c,f,k}
L5 = {g,h,k}
L6=  {c,e,g}
for i in range(N):
	for j in range(N):
		for k in range(N):
			s = set([l[i],l[j],l[k]])
			if (s == L1) or (s == L2) or (s == L3) or (s == L4) or (s == L5) or (s==L6):
				print('Yes')
				exit(0)
		
print('No')

Submission status: Wrong Answer

Solution code:

a,b,c = list(map(int, input().split()))
d,e,f = list(map(int, input().split()))	
g,h,k = list(map(int, input().split()))
N = int(input())
l = []
for i in range(N):
	e=int(input())
	l.append(e)
L1 = {a,d,g}
L2 = {a,b,c}
L3 = {a,e,k}
L4 = {c,f,k}
L5 = {g,h,k}
for i in range(N):
	for j in range(N):
		for k in range(N):
			s = set([l[i],l[j],l[k]])
			if (s == L1) or (s == L2) or (s == L3) or (s == L4) or (s == L5):
				print('Yes')
				exit(0)
		
print('No')

Submission status: Wrong Answer

Solution code:
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = list(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
                break

for i in range(3):
    if a[i][0] == 0 and a[i][1] == 0 and a[i][2] == 0:
        print("Yes")
        break
    elif a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0:
        print("Yes")
        break
    elif a[i][i] == 0 and a[i][i] == 0 and a[i][i] == 0:
        print("Yes")
        break
    elif a[-i][-i] == 0 and a[-i][-i] == 0 and a[-i][-i] == 0:
        print("Yes")
        break
else:
    print("No")

Submission status: Wrong Answer

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

        for k in range(3):
            for l in range(3):
                if int(bingo[k][l]) == b:
                    bingo[k][l] = -1
    
    for ii in range(3):
        
        if bingo[ii][0:3] == [-1,-1,-1] or [bingo[0][ii],bingo[1][ii],bingo[2][ii]] == [-1,-1,-1] or [bingo[0][0],bingo[1][1],bingo[2][2]] == [-1,-1,-1] or [bingo[2][0],bingo[1][1],bingo[0][2]] == [-1,-1,-1]:
            
            print('yes')
            break
    else:
        print('No')




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

        for k in range(3):
            for l in range(3):
                if int(bingo[k][l]) == b:
                    bingo[k][l] = -1
        
    for ii in range(3):
    
        if bingo[ii][0:3] == [-1,-1,-1] or [bingo[0][ii],bingo[1][ii],bingo[2][ii]] == [-1,-1,-1] or [bingo[0][0],bingo[1][1],bingo[2][2]] == [-1,-1,-1] or [bingo[2][0],bingo[1][1],bingo[0][2]] == [-1,-1,-1]:
            print('yes')
            break
    else:
        print('No')




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

        for k in range(3):
            for l in range(3):
                if int(bingo[k][l]) == b:
                    bingo[k][l] = -1
        
    for ii in range(3):
        if bingo[ii][0:3] == [-1,-1,-1] or bingo[0:3][ii] == [-1,-1,-1] or [bingo[0][0],bingo[1][1],bingo[2][2]] == [-1,-1,-1] or [bingo[2][0],bingo[1][1],bingo[0][2]] == [-1,-1,-1]:
            print('yes')
            break
    else:
        print('No')




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
card = [input().split(' '), input().split(' '), input().split(' ')]
count = int(input())

result = [[0 for _ in range(3)] for _ in range(3)]

for _ in range(count):
    b = int(input())
    for i, cc in enumerate(card):
        for j, c in enumerate(cc):
            if c == b:
                result[i][j] = 1

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

Submission status: Wrong Answer

Solution code:
mat = [[0 for i in range(3)] for j in range(3)]
for i in range(3):
    mat[i] = list(map(int, input().split()))

n = int(input())
for _ in range(n):
    b = int(input())
    for x in range(3):
        for y in range(3):
            if mat[x][y] == b:
                mat[x][y] = 101

flg = False
for x in range(3):
    if (mat[x][0], mat[x][1], mat[x][2] == [101, 101, 101]):
        flg = True

for x in range(3):
    if (mat[0][x], mat[1][x], mat[2][x] == [101, 101, 101]):
        flg = True

if (mat[0][0], mat[1][1], mat[2][2] == [101, 101, 101]):
    flg = True

if (mat[0][2], mat[1][1], mat[2][0] == [101, 101, 101]):
    flg = True

print("Yes") if flg else print("No")

Submission status: Wrong Answer

Solution code:
mat = [[0 for i in range(3)] for j in range(3)]
for i in range(3):
    mat[i] = list(map(int, input().split()))

n = int(input())
for _ in range(n):
    b = int(input())
    for x in range(3):
        for y in range(3):
            if mat[x][y] == b:
                mat[x][y] = 0

flg = False
for x in range(3):
    if (mat[x][0], mat[x][1], mat[x][2] == [0, 0, 0]):
        flg = True

for x in range(3):
    if (mat[0][x], mat[1][x], mat[2][x] == [0, 0, 0]):
        flg = True

if (mat[0][0], mat[1][1], mat[2][2] == [0, 0, 0]):
    flg = True

if (mat[0][2], mat[1][1], mat[2][0] == [0, 0, 0]):
    flg = True

print("Yes") if flg else print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np
bingo = np.array([list(map(int,input().split())) for i in range(3)])
n = int(input())
num = np.array([int(input()) for i in range(n)])
#for i in num:

Submission status: Wrong Answer

Solution code:
# import math
# import bisect
# import heapq
# from collections import deque
# import numpy as np

# n, m = map(int, input().split())

a = [0] * 9
i = 0
for _ in range(3):
    b,c,d = map(int, input().split())
    # print(b,c,d)
    a[i],a[i+1],a[i+2] = b,c,d

    i += 3
# print(a)
ans = 'No'

n = int(input())

b = [ int(input()) for i in range(n) ]
# print(b)
for i in range(n):
    for j in range(9):
        a[j] = -1 if b[i] == a[j] else a[j]

pairs = [
    [0,1,2],[3,4,5],[6,7,8],
    [0,3,6],[1,4,7],[3,5,8],
    [0,4,8],[2,4,6]]

for p in pairs:
    if a[p[0]] == -1 and a[p[1]] == -1 and a[p[2]] == -1:
        ans = 'Yes'


print(ans)

Submission status: Wrong Answer

Solution code:
datalist = [list(map (int, input().split(" "))) for i in range(3)]
checktbl = [[0]*3]*3
num = int(input())
for i in range(num):
    data = int(input())
    for j in range(3):
        for k in range(3):
            if datalist[k][j] == data:
                checktbl[k][j] = 1

result = "No"
for i in range(3):
    if checktbl[i][0] == 1 and checktbl[i][1] == 1 and checktbl[i][2] == 1:
        result = "Yes"
for i in range(3):
    if checktbl[0][i] == 1 and checktbl[1][i] == 1 and checktbl[2][i] == 1:
        result = "Yes"
if checktbl[0][0] == 1 and checktbl[1][1] == 1 and checktbl[2][2] == 1:
    result = "Yes"
if checktbl[0][2] == 1 and checktbl[1][1] == 1 and checktbl[2][0] == 1:
    result = "Yes"

print(result)

Submission status: Wrong Answer

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"[S.find("  ")<0::2])

Submission status: Wrong Answer

Solution code:
a=[[int(x) for x in input().split()] for _ in range(3)]
d1=[a[0][0], a[1][1], a[2][2]]
d2=[a[2][0], a[1][1], a[0][2]]
c1=[a[0][0], a[0][1], a[0][2]]
c2=[a[1][0], a[1][1], a[1][2]]
c3=[a[2][0], a[2][1], a[2][2]]
n=int(input())
b=[int(input()) for _ in range(n)]
f=False
for i in a:
  if all(elem in b for elem in i):
    f=True
    print("Yes")
    break
if not f:
  if all(elem in b for elem in d1):
    print("Yes")
  elif all(elem in b for elem in d2):
    print("Yes")
  elif all(elem in b for elem in c1):
    print("Yes")
  elif all(elem in b for elem in c2):
    print("Yes")
  elif all(elem in b for elem in c3):
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
a=[[int(x) for x in input().split()] for _ in range(3)]
d1=[a[0][0], a[1][1], a[2][2]]
d2=[a[2][0], a[1][1], a[0][2]]
n=int(input())
b=[int(input()) for _ in range(n)]
f=False
for i in a:
  if all(elem in b for elem in i):
    f=True
    break
if not f:
  if all(elem in b for elem in d1):
    print("Yes")
  elif all(elem in b for elem in d2):
    print("Yes")
  else:
    print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
S="012 345 678 036 147 258 048 246 "
A=[]
A.extend(list(map(int,input().split())) for i in range(3))
N=int(input())
for i in range(N):
  j=input()
  for l in range(3):
    for m in range(3):
      S=S.replace(str([0,l*3+m][A[l][m]==int(j)]),"")
print(["No","Yes"][S.find("  ")>-1])

Submission status: Wrong Answer

Solution code:
S="123 456 789 147 258 369 159 357 "
A=[]
A.extend(list(map(int,input().split())) for i in range(3))
N=int(input())
for i in range(N):
  j=input()
  for l in range(3):
    for m in range(3):
      if A[l][m]==int(j):
        S=S.replace(j,"")
print(["No","Yes"][S.find("  ")>-1])

Submission status: Wrong Answer

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

def disclose(card, n, lst):
  for i in range(n):
    for j in range(3):
      for k in range(3):
        if card[j][k] == lst[i]:
          card[j][k] = 0
  return card
          
def trans(matrix):
  tr = []
  for i in range(len(matrix[0])):
    vector = []
    for j in range(len(matrix)):
      vector.append(matrix[j][i])
    tr.append(vector)
  return tr

def bingo(card):
  if card[0] == [0,0,0]:
    return True
  if card[1] == [0,0,0]:
    return True
  if card[2] == [0,0,0]:
    return True
  for i in range(3):
    if card[i][i] != 0:
      break
    if i == 2:
      return True
  card = trans(card)
  if card[0] == [0,0,0]:
    return True
  if card[1] == [0,0,0]:
    return True
  if card[2] == [0,0,0]:
    return True
  for i in range(3):
    if card[i][i] != 0:
      break
    if i == 2:
      return True
  return False
    
def judge(x):
  if x:
    return "Yes"
  return "No"

print(judge(bingo(disclose(card, N, List))))

Submission status: Wrong Answer

Solution code:

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

arr = [[0 for i in range(3)] for j in range(3)]

#print(arr)
for j in range(3):
  for i in range(3):
    if A[i][j] in b:
      #print(A[i][j])
      arr[i][j] = 1
#print(arr)
f = 0
for i in range(3):
  if sum(arr[i][:]) == 3 and f == 0:
    print("Yes")
    f = 1

  if (arr[0][i] + arr[1][i] + arr[2][i] == 3) and f == 0:
    print("Yes")
    f = 1
if f == 0:
  if arr[0][0] + arr[1][1] + arr[2][2]:
    print("Yes")
  elif arr[0][2] + arr[1][1] + arr[2][0]:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
N=list(map(int,input().split()))
if (a or b or c) in N:
  print("Yes")
elif (a[0] and b[0] and c[0]) in N:
  print("Yes")
elif (a[0] and b[1] and c[2]) in N:
  print("Yes")
elif (a[1] and b[1] and c[1]) in N:
  print("Yes")
elif (a[2] and b[2] and c[2]) in N:
  print("Yes")
elif (a[2] and b[1] and c[0]) in N:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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, 3):
    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: Wrong Answer

Solution code:
A = []
for i in range(3):
  for x in input().split():
    A.append(int(x))
    
N = int(input())

for _ in range(N):
  y = int(input())
  A = [0 if x == y else x for x in A]

if any((sum(A[::3]) == 0,
       sum(A[1::3]) == 0,
       sum(A[2::3]) == 0,
       sum(A[::4]) == 0,
       sum(A[2:7:2]) == 0)):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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 = [input() for i in range(N)]

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: Wrong Answer

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

n = int(input())

bingo = [[0] * 3 for _ in range(3)]

for _ in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j] == b:
                bingo[i][j] = 1

ok = False

for i in range(3):
    count = 0
    for j in range(3):
        count += bingo[i][j]
        if count == 3:
            ok = True
for i in range(3):
    count = 0
    for j in range(3):
        count += bingo[j][i]
        if count == 3:
            ok = True
count = 0
for i in range(3):
    count += bingo[i][i]
    if count == 3:
        ok = True
count = 0
for i in range(3):
    count += bingo[2-i][i]
    if count == 0:
        ok = True

print("Yes" if ok else "No")

Submission status: Wrong Answer

Solution code:
a = [list(map(int, 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] = 0

ok = True

for i in range(3):
    count = 0
    for j in range(3):
        count += a[i][j]
        if count != 0:
            ok = False
for i in range(3):
    count = 0
    for j in range(3):
        count += a[j][i]
        if count != 0:
            ok = False
count = 0
for i in range(3):
    count += a[i][i]
    if count != 0:
        ok = False
count = 0
for i in range(3):
    count += a[2-i][i]
    if count != 0:
        ok = False

print("Yes" if ok else "No")

Submission status: Wrong Answer

Solution code:
a = [list(map(int, 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] = 0

ok = False

for i in range(3):
    count = 0
    for j in range(3):
        count += a[i][j]
        if count == 0:
            ok = True
for i in range(3):
    count = 0
    for j in range(3):
        count += a[j][i]
        if count == 0:
            ok = True
count = 0
for i in range(3):
    count += a[i][i]
    if count == 0:
        ok = True
count = 0
for i in range(3):
    count += a[2-i][i]
    if count == 0:
        ok = True

print("Yes" if ok else "No")

Submission status: Wrong Answer

Solution code:
a = [list(map(int, 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] = 0

ok = False

for i in range(3):
    count = 0
    for j in range(3):
        count += a[i][j]
    if count == 0:
        ok = True
for i in range(3):
    count = 0
    for j in range(3):
        count += a[j][i]
    if count == 0:
        ok = True
count = 0
for i in range(3):
    count += a[i][i]
    if count == 0:
        ok = True
count = 0
for i in range(3):
    count += a[2-i][i]
    if count == 0:
        ok = True

print("Yes" if ok else "No")

Submission status: Wrong Answer

Solution code:
a = [list(map(int, 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] = 0

ok = False

for i in range(3):
    count = 0
    for j in range(3):
        count += a[i][j]
    if count == 0:
        ok = True
for i in range(3):
    count = 0
    for j in range(3):
        count += a[j][i]
    if count == 0:
        ok = True
count = 0
for i in range(3):
    count += a[i][i]
    if count == 0:
        ok = True
count = 0
for i in range(3):
    count += a[i][2-i]
    if count == 0:
        ok = True

print("Yes" if ok else "No")

Submission status: Wrong Answer

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

n = int(input())

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

ok = False

bingo = [[0] * 3] * 3

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

for i in range(3):
    count = 0
    for j in range(3):
        count += bingo[i][j]
    if count == 3:
        ok = True
for i in range(3):
    count = 0
    for j in range(3):
        count += bingo[j][i]
    if count == 3:
        ok = True
count = 0
for i in range(3):
    count += bingo[i][i]
    if count == 3:
        ok = True
count = 0
for i in range(3):
    count += bingo[i][2-i]
    if count == 3:
        ok = True

print("Yes" if ok else "No")

Submission status: Wrong Answer

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())
if A[0] <= B or A[1] <= B or A[2] <= B or {A[0][0], A[1][0], A[2][0]} <= set(B) or\
{A[0][1], A[1][1], A[2][1]} <= set(B) or {A[0][2], A[1][2], A[2][2]} <= set(B) \
or {A[0][0], A[1][1], A[2][2]} <= set(B) or {A[0][2], A[1][1], A[2][0]} <= set(B):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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())
if A[0] <= B or A[1] <= B or A[2] <= B or {A[0][0], A[1][0], A[2][0]} <= set(B) or\
{A[0][1], A[1][1], A[2][1]} <= set(B) or {A[0][2], A[1][2], A[2][2]} <= set(B) \
or {A[0][0], A[1][1], A[2][2]} <= set(B) or {A[2][2], A[1][1], A[2][0]} <= set(B):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

for i in range(N):
    for a in range(3):
        for b in range(3):
            if(B[i]==A[a][b]):
                A[a][b] = 0
for i in range(3):
    if(A[i]==[0,0,0]):
        bingo = "Yes"
    if(A[0][i]==0 or A[1][i]==0 or A[2][i]==0):
        bingo = "Yes"
if(A[0][0]==0 and A[1][1]==0 and A[2][2]==0):
        bingo = "Yes"
if(A[0][2]==0 and A[1][1]==0 and A[2][0]==0):
        bingo = "Yes"

print(bingo)

Submission status: Wrong Answer

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(cards[0:3]) == 0):
    print('Yes')
elif (sum(cards[3:6]) == 0):
    print('Yes')
elif (sum(cards[6:8]) == 0):
    print('Yes')
elif ((cards[0] + cards[3] + cards[6]) == 0):
    print('Yes')
elif ((cards[1] + cards[4] + cards[7]) == 0):
    print('Yes')
elif ((cards[2] + cards[5] + cards[8]) == 0):
    print('Yes')
elif ((cards[0] + cards[4] + cards[8]) == 0):
    print('Yes')
elif ((cards[2] + cards[4] + cards[6]) == 0):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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(cards[0:3]) == 0):
    print('Yes')
elif (sum(cards[3:6]) == 0):
    print('Yes')
elif (sum(cards[7:9]) == 0):
    print('Yes')
elif ((cards[0] + cards[3] + cards[6]) == 0):
    print('Yes')
elif ((cards[1] + cards[4] + cards[7]) == 0):
    print('Yes')
elif ((cards[2] + cards[5] + cards[8]) == 0):
    print('Yes')
elif ((cards[0] + cards[4] + cards[8]) == 0):
    print('Yes')
elif ((cards[2] + cards[4] + cards[6]) == 0):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
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):
        if b in a[j]:
            a[j][a[j].index(b)]=0
if a[0][0]==a[1][1]==a[2][2] or a[0][2]==a[1][1]==a[2][0]:
    print("Yes")
elif a[0][0]==a[0][1]==a[0][2] or a[1][0]==a[1][1]==a[1][2] or a[0][0]==a[0][1]==a[0][2]:
    print("Yes")
elif a[0][0]==a[1][0]==a[2][0] or a[0][1]==a[1][1]==a[2][1] or a[0][2]==a[1][2]==a[2][2]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
A=[[int(x) for x in input().split()] for _ in range(3)]
s=[[0]*3]*3

for i in range(int(input())):
  n=int(input())
  for y in range(3):
    for x in range(3):
      if A[y][x]==n:
        s[y][x]=1

for x in range(3):
  if s[0][x]*s[1][x]*s[2][x]:
    print('Yes')
    exit()

for y in range(3):
  if s[y][0]*s[y][1]*s[y][2]:
    print('Yes')
    exit()

if s[0][0]*s[1][1]*s[2][2] or s[0][2]*s[1][1]*s[2][0]:
  print('Yes')
  exit()

print('No')

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readlines()
nums = []
[[nums.append(num) for num in row.strip().split(" ")] for row in input[:3]]
bs = [i.strip() for i in input[4:]]
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")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readlines()
nums = []
[[nums.append(num) for num in row.strip().split(" ")] for row in input[:3]]
bs = [i.strip() for i in input[4:]]
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: Wrong Answer

Solution code:
import sys
input = sys.stdin.readlines()
nums = []
[[nums.append(num) for num in row.strip().split(" ")] for row in input[:3]]
bs = [i.strip() for i in input[4:]]
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")