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 = []
for i in range(3):
    a = list(map(int, input().split()))
    A.append(a)

N = int(input())
B1 = []
for n in range(N):
    b = int(input())
    B1.append(b)
B2 = list(set(B1))

for y in range(3):
    for z in range(3):
        for x in B2:
            if x == A[y][z]:
                A[y][z] = 0

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

Submission status: Wrong Answer

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

N = int(input())
B1 = []
for n in range(N):
    b = int(input())
    B1.append(b)
B2 = list(set(B1))

for x in B2:
    for y in range(3):
        for z in range(3):
            if x == A[y][z]:
                A[y][z] = 0

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

Submission status: 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)]
for i in range(3):
  for j in range(3):
    for k in b:
      if a[j][i] == k:
            a[j][i] = 'o'
a1 = list(set(a[0]))
a2 = list(set(a[1]))
a3 = list(set(a[2]))
a4 = list(set((a[0][0],a[1][1],a[2][2])))
a5 = list(set((a[0][2],a[1][1],a[2][0])))
a6 = list(set(a[:][0]))
a7 = list(set(a[:][1]))
a8 = list(set(a[:][2]))
p = ['o']
A = [a1,a2,a3,a4,a5,a6,a7,a8]
for i in A:
    ans = 'No'
    if i == p:
        ans = 'Yes'
        break
print(ans)

Submission status: Wrong Answer

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

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

for x in B:
    for y in range(3):
        for z in range(3):
            if x == A[y][z]:
                A[y][z] = 0

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

Submission status: Wrong Answer

Solution code:
a= []
for i in range(3):
  a_input = input().split(" ")
  a.append(a_input)


n = int(input())

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

for i in range(3):
    #縦
    if a[0][i] =="0" and a[0][i] == a[1][i] and a[0][i] == a[2][i]:
      print("Yes")
      break
    #横
    elif a[i][0] =="0" and a[i][0] == a[i][1] and a[i][0] == a[i][2]:
      print("Yes")
      break
    #斜め（右上から左下）
    elif a[0][0] =="0" and a[0][0] == a[1][1] and a[1][1] == a[2][2]:
      print("Yes")
      break
    #斜め（右下から左上）  
    elif a[0][2] =="0" and a[0][2] == a[1][1] and a[0][2] == a[2][0]:
      print("Yes")
      break
    else:
      print("No")
      break

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)]
for i in range(3):
  for j in range(3):
    for k in(B):
      if A[j][i] == k:
        A[i][j] = 1
        break
      elif k == B[-1]:
        A[i][j] = 0
if sum(A[0]) == 3 or sum(A[1]) == 3 or sum(A[2]) == 3:
  print('Yes')
elif sum([row[0] for row in A]) == 3 or sum([row[1] for row in A]) == 3 or sum([row[2] for row in A]) == 3:
  print('Yes')
elif A[0][0] + A[1][1] + A[2][2] == 3 or A[2][0] + A[1][1] + A[0][2] == 3:
  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)]
for i in range(3):
  for j in range(3):
    for k in(B):
      if A[j][i] == k:
        A[i][j] = 1
        break
      elif k == B[-1]:
        A[i][j] = 0
if sum(A[0]) == 3 or sum(A[1]) == 3 or sum(A[2]) == 3:
  print('Yes')
elif sum([row[0] for row in A]) == 3 or sum([row[1] for row in A]) == 3 or sum([row[2] for row in A]) == 3:
  print('Yes')
elif A[0][0] + A[1][1] + A[2][2] == 3 or A[2][0] + A[1][1] + A[1][2] == 3:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
a= []
for i in range(3):
  a_input = input().split(" ")
  a.append(a_input)


n = int(input())

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

for i in range(3):
    #縦
    if a[0][i] == a[1][i] and a[0][i] == a[2][i]:
      print("Yes")
      break
    #横
    elif a[i][0] == a[i][1] and a[i][0] == a[i][2]:
      print("Yes")
      break
    #斜め（右上から左下）
    elif a[0][0] == a[1][1] and a[1][1] == a[2][2]:
      print("Yes")
      break
    #斜め（右下から左上）  
    elif a[0][2] == a[1][1] and a[0][2] == a[2][0]:
      print("Yes")
      break
    else:
      print("No")
      break

Submission status: Wrong Answer

Solution code:
a= []
for i in range(3):
  a_input = input().split(" ")
  a.append(a_input)


n = int(input())

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

for j in range(3):
    #縦
    if a[0][j] == a[1][j] and a[0][j] == a[2][j]:
      print("Yes")
      break
    #横
    elif a[j][0] == a[j][1] and a[j][0] == a[j][2]:
      print("Yes")
      break
    #斜め（右上から左下）
    elif a[0][0] == a[1][1] and a[1][1] == a[2][2]:
      print("Yes")
      break
    #斜め（右下から左上）  
    elif a[0][2] == a[1][1] and a[0][2] == a[2][0]:
      print("Yes")
      break
    else:
      print("No")
      break

Submission status: Wrong Answer

Solution code:
a= []
for i in range(3):
  a_input = input().split(" ")
  a.append(a_input)


n = int(input())

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

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

Submission status: Wrong Answer

Solution code:
a= []
for i in range(3):
  a_input = input().split(" ")
  a.append(a_input)


n = int(input())

for i in range(n):
  x = int(input())
  for j in range(3):
    for k in range(3):
      if x == int(a[j][k]):
        a[j][k] = 0
print(a)
for i in range(3):
    if a[0][j] == a[1][j] and a[0][j] == a[2][j]:
      print("Yes")
      break
    elif a[j][0] == a[j][1] and a[j][0] == a[j][2]:
      print("Yes")
      break
    elif a[0][0] == a[1][1] and a[1][1] == a[2][2]:
      print("Yes")
      break
    elif a[0][2] == a[1][1] and a[0][2] == a[2][0]:
      print("Yes")
      break
    else:
      print("No")
      break

Submission status: Wrong Answer

Solution code:
a= []
for i in range(3):
  a_input = input().rstrip().split(" ")
  a.append(a_input)


n = int(input())

for i in range(n):
  x = int(input())
  for j in range(3):
    for k in range(3):
      if x == int(a[j][k]):
        a[j][k] = 0
for i in range(3):
    if a[0][j] == a[1][j] and a[0][j] == a[2][j]:
      print("Yes")
      break
    elif a[j][0] == a[j][1] and a[j][0] == a[j][2]:
      print("Yes")
      break
    elif a[0][0] == a[1][1] and a[1][1] == a[2][2]:
      print("Yes")
      break
    elif a[0][2] == a[1][1] and a[0][2] == a[2][0]:
      print("Yes")
      break
    else:
      print("No")
      break

Submission status: Wrong Answer

Solution code:
a= []
for i in range(3):
  a_input = input().rstrip().split(" ")
  a.append(a_input)


n = int(input())

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

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

Submission status: Wrong Answer

Solution code:
# ABC 157: B – Bingo
A = [input().split() for _ in range(3)]
N = int(input())
b = [input() for _ in range(N)]

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

isBingo = 'No'

if '000' in A:
    isBingo = 'Yes'
for j in range(3):
    if A[0][j] + A[1][j] + A[2][j] == '000':
        isBingo = 'Yes'
        break
if A[0][0] + A[1][1] + A[2][2] == '000' or A[2][0] + A[1][1] + A[0][2] == '000':
    isBingo = 'Yes'

print(isBingo)

Submission status: Wrong Answer

Solution code:
def bingo_check() :
    if (list[0][0] and list[1][1] and list[2][2]) in bingo :
        print('Yes')
    elif (list[0][2] and list[1][1] and list[2][0]) in bingo :
        print('Yes')
    else:
        for p in range(3):
            if (list[0][p] and list[1][p] and list[2][p]) in bingo :
                ptint('Yes')
                break
            elif (list[p][0] and list[p][1] and list[p][2]) in bingo :
                print('Yes')
                break
            else :
                if p == 2 :
                    print('No')
                else :
                    continue

a, b, c = map(int, input().split())
d, e, f = map(int, input().split())
g, h, i = map(int, input().split())

N = int(input())

cnt = 0
list = [[a, b, c],[d, e, f],[g, h, i]]
bingo = []

while cnt < N :
    bin = int(input())
    bingo.append(bin)
    cnt += 1

bingo_check()

Submission status: Wrong Answer

Solution code:
def bingo_check() :
    if list[0][0] and list[1][1] and list[2][2] in bingo :
        print('Yes')
    elif list[0][2] and list[1][1] and list[2][0] in bingo :
        print('Yes')
    else:
        for p in range(3):
            if list[0][p] and list[1][p] and list[2][p] in bingo :
                ptint('Yes')
                break
            elif list[p][0] and list[p][1] and list[p][2] in bingo :
                print('Yes')
                break
            else :
                if p == 2 :
                    print('No')
                else :
                    continue

a, b, c = map(int, input().split())
d, e, f = map(int, input().split())
g, h, i = map(int, input().split())

N = int(input())

cnt = 0
list = [[a, b, c],[d, e, f],[g, h, i]]
bingo = []

while cnt < N :
    bin = int(input())
    bingo.append(bin)
    cnt += 1

bingo_check()

Submission status: Wrong Answer

Solution code:
def bingo_check() :
    if list[0][0] and list[1][1] and list[2][2] in bingo :
        print('Yes')
    elif list[0][2] and list[1][1] and list[2][0] in bingo :
        print('Yes')
    else:
        for p in range(3):
            if list[0][p] and list[1][p] and list[2][p] in bingo :
                ptint('Yes')
                break
            elif list[p][0] and list[p][1] and list[p][2] in bingo :
                print('Yes')
                break
            else :
                continue
        else :
            print('No')

a, b, c = map(int, input().split())
d, e, f = map(int, input().split())
g, h, i = map(int, input().split())
N = int(input())

cnt = 0
list = [[a, b, c],[d, e, f],[g, h, i]]
bingo = []

while cnt < N :
    bin = int(input())
    bingo.append(bin)
    cnt += 1

if cnt == 1 or cnt == 2 :
    print('No')
else :
    bingo_check()

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
d,e,f=map(int,input().split())
g,h,i=map(int,input().split())
n=int(input())
B=[int(input()) for j in  range(n)]

if (a and b and c in B) or (d and e and f in B) or (g and h and i in B) or (a and d and g in B) or (b and e and h in B) or (c and f and i in B) or (a and e and i in B) or (c and e and g in B):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
x = []
b = []
for i in range(3):
    s = list(map(int,input().split()))
    x.append(s)
N = int(input())
for j in range(N):
    b.append(int(input()))
temp =0
for j in range(3):
    if x[0][j] in b and x[1][j] in b and x[2][j] in b:
        temp = 1
        break
for j in range(3):
    if x[j][0] in b and x[j][1] in b and x[j][2] in b:
        temp = 1
        break
if x[0][0] in b and x[1][1] in b and x[2][2] in b:
    temp = 1
elif x[1][2] in b and x[1][1] in b and x[2][0] in b:
    temp = 1
if temp ==1:
    print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
array1 = list(map(int, input().split()))
array2 = list(map(int, input().split()))
array3 = list(map(int, input().split()))
check = [[False]*3 for _ in range(3)]
flg=False
# print(check)
N = int(input())
for i in range(N):
    bingo = int(input())
    for j in range(3):
        if array1[j] == bingo:
            check[0][j] = True
        if array2[j] == bingo:
            check[1][j] = True
        if array3[j] == bingo:
            check[2][j] = True
if check[0][0] == True and check[1][1] == True and check[2][2] == True:
    print('Yes')
    flg=True
if check[0][2] == True and check[1][1] == True and check[2][0] == True:
    print('Yes')
    flg=True
else:
    for k in range(3):
        if check[0][k] == True and check[1][k] == True and check[2][k] == True:
            print('Yes')
            flg=True
            break
        if check[k][0] == True and check[k][1] == True and check[k][2] == True:
            print('Yes')
            flg=True
            break
if flg==False:
    print('No')

Submission status: Wrong Answer

Solution code:
array1 = list(map(int, input().split()))
array2 = list(map(int, input().split()))
array3 = list(map(int, input().split()))
check = [[False]*3 for _ in range(3)]
flg=False
# print(check)
N = int(input())
for i in range(N):
    bingo = int(input())
    for j in range(3):
        if array1[j] == bingo:
            check[0][j] = True
        if array2[j] == bingo:
            check[1][j] = True
        if array3[j] == bingo:
            check[2][j] = True
if check[0][0] == True and check[1][1] == True and check[2][2] == True:
    print('Yes')
    flg=True
else:
    for k in range(3):
        if check[0][k] == True and check[1][k] == True and check[2][k] == True:
            print('Yes')
            flg=True
            break
        if check[k][0] == True and check[k][1] == True and check[k][2] == True:
            print('Yes')
            flg=True
            break
if flg==False:
    print('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)]

key = []
for i, v in enumerate(A):
    for k, j in enumerate(v):
        if (j in B):
            key.append([i, k])

ans = [[[0, 0], [1, 0], [2, 0]], [[0, 1], [1, 1], [2, 1]], [[0, 2], [1, 2], [2, 2]], [[0, 0], [1, 1], [2, 2]], [
    [0, 2], [1, 1], [2, 0]], [[0, 0], [0, 1], [0, 2]], [[1, 0], [1, 1], [1, 2]], [[2, 0], [2, 1], [2, 2]]]

for i in ans:
    for j in i:
        if (j in key):
            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())
b = [int(input()) for i in range(n)]

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

ans = "No"
for i in range(3):
    if a[i][0] + a[i][1] + a[i][2] == 0:
        print("Yes")
        exit()

    if a[0][i] + a[1][i] + a[2][0] == 0:
        print("Yes")
        exit()

if a[0][0] + a[1][1] + a[2][2] == 0:
    print("Yes")
    exit()
if a[2][0] + a[1][1] + a[0][2] == 0:
    print("Yes")
    exit()

print(ans)

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)]

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

ans = "No"
for i in range(3):
    if a[i][0] + a[i][1] + a[i][2] == 0:
        ans = "Yes"
    if a[0][i] + a[1][i] + a[2][0] == 0:
        ans = "Yes"

if a[0][0] + a[1][1] + a[2][2] == 0:
    ans = "Yes"
if a[2][0] + a[1][1] + a[0][2] == 0:
    ans = "Yes"

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

BINGO = np.array([[False for i in range(3)]for j in range(3)])

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

#横確認
for i in BINGO:
    if False not in i:
        print("Yes")
        exit()

BINGO = BINGO.T # 縦横を入れ替えTはnumpyの関数

#縦確認
for i in BINGO:
    if False not in i:
        print("Yes")
        exit()

#斜め確認
cross = [BINGO[i][i] for i in range(3)]
cross_re = [BINGO[i][2-i] for i in range(3)]

if False not in (cross or cross_re):
    print("Yes")
    exit()

print("No")

Submission status: Wrong Answer

Solution code:
import numpy as np
tmps = []
for i in range(3):
    tmp = list(map(int, input().split(' ')))
    tmps.append(tmp)
bingo = np.array(tmps)
N = int(input())
for i in range(N):
    bingo = np.where(bingo==i, -1, bingo)
c = 2
x1 = 0
x2 = 0
ret = []
for i in range(3):
    row = np.sum(bingo[i, :])
    col = np.sum(bingo[:, i])
    x1 += np.sum(bingo[i, i])
    x2 += np.sum(bingo[i, c-i])
    ret.append(row)
    ret.append(col)
ret.append(x1)
ret.append(x2)
if -3 in ret:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
A = []

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

N = int(input())

check = [[0]*3]*3
for n in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == b:
                 check[i][j] = 1

ans = 'No'
for i in range(3):
    if check[i][0]+check[i][1]+check[i][2]==3:
        ans = 'Yes'

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

if check[0][0]+check[1][1]+check[2][2] == 3:
    ans = 'Yes'

if check[0][2]+check[1][1]+check[2][0] == 3:
    ans = 'Yes'

print(ans)

Submission status: Wrong Answer

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

res = 'NO'
for l in range(3):
    if sum(a[l]) == 0:
        res = 'Yes'
    else:
        nl = []

        for m in range(3):
            nl.append(a[m][l])

        if sum(nl) == 0:
            res = 'Yes'
if sum([a[0][0],a[1][1],a[2][2]]) == 0:
    res = 'Yes'
if sum([a[2][2], a[1][1], a[2][1]]) == 0:
    res = 'Yes'
print res

Submission status: Wrong Answer

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

res = 'NO'
for l in range(3):
    if sum(a[l]) == 0:
        res = 'Yes'
    else:
        nl = []

        for m in range(3):
            nl.append(a[m][l])
    
        if sum(nl) == 0:
            res = 'Yes'
if sum([a[0][0],a[1][1],a[2][2]]) == 0:
    res = 'Yes'
print res

Submission status: Wrong Answer

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

res = 'NO'
for l in range(3):
    if sum(a[l]) == 0:
        res = 'Yes'
    else:
        nl = []
        for m in range(3):
            nl.append(a[l][m])
        if sum(nl) == 0:
            res = 'Yes'
if sum([a[0][0],a[1][1],a[2][2]]) == 0:
    res = 'Yes'
print res

Submission status: Wrong Answer

Solution code:
def check(a,b):
    if a==b:
        a=-1

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

i = 0
j = 0
while i<N:
    b = int(input())
    while j<3:
        check(A1[j],b)
        j+=1
    while j<3:
        check(A2[j],b)
        j+=1
    while j<3:
        check(A3[j],b)
        j+=1
    i+=1

if A1[0]==A1[1]==A1[2] or A2[0]==A2[1]==A2[2] or A3[0]==A3[1]==A3[2] or A1[0]==A2[0]==A3[0] or A1[1]==A2[1]==A3[1] or A1[2]==A2[2]==A3[2] or A1[0]==A2[1]==A3[2] or A1[2]==A2[1]==A3[0]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
A = []

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

N = int(input())

check = [[0]*3]*3
for n in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == b:
                 check[i][j] = 1

ans = 'No'
for i in range(3):
    if check[i][0]+check[i][1]+check[i][2]==3:
        ans = 'Yes'
    if check[0][i]+check[1][i]+check[2][i]==3:
        ans = 'Yes'

if check[0][0]+check[1][1]+check[2][2] == 3:
    ans = 'Yes'

if check[2][0]+check[1][1]+check[0][2] == 3:
    ans = 'Yes'

print(ans)

Submission status: Wrong Answer

Solution code:
A = []

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

N = int(input())

check = [[0]*3]*3
for n in range(N):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == b:
                 check[i][j] = 1

ans = 'No'
for i in range(3):
    if sum(check[i])==3:
        ans = 'Yes'
    if check[0][i]+check[1][i]+check[2][i]==3:
        ans = 'Yes'

if check[0][0]+check[1][1]+check[2][2] == 3:
    ans = 'Yes'

if check[2][0]+check[1][1]+check[0][2] == 3:
    ans = 'Yes'

print(ans)

Submission status: Wrong Answer

Solution code:
l=[list(input().split()) for i in range(3)]
n=int(input())
li=[input() for i in range(n)]
if l[0][0] and l[0][1] and l[0][2] in li:
    print('Yes')
elif l[1][0] and l[1][1] and l[1][2] in li:
    print('Yes')
elif l[2][0] and l[2][1] and l[2][2] in li:
    print('Yes')
elif l[0][0] and l[1][0] and l[2][0] in li:
    print('Yes')
elif l[0][1] and l[1][1] and l[2][1] in li:
    print('Yes')
elif l[0][2] and l[1][2] and l[2][2] in li:
    print('Yes')
elif l[0][0] and l[1][1] and l[2][2] in li:
    print('Yes')
elif l[0][2] and l[1][1] and l[2][0] in li:
    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)]

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

if A[1][1]==0 and A[0][0]==0 and A[2][2]==0 or A[1][1]==0 and A[2][0]==0 and A[0][2]==0 or A[1][1]==0 and A[0][1]==0 and A[2][1]==0 or A[1][1]==0 and A[1][0]==0 and A[2][0]==0 or A[0][0]==0 and A[0][1]==0 and A[0][1]==0 or A[0][0]==0 and A[1][0]==0 and A[2][0]==0 or A[2][2]==0 and A[0][2]==0 and A[1][2]==0 or A[2][2]==0 and A[2][0]==0 and A[2][1]==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)]
for i in range(3):
    for j in range(3):
      for k in range(3):
        if a[i][j] == b[k]:
            a[i][j] = 0
ans = 'No'
for i in range(3):
    if a[i][0]+a[i][1]+a[i][2] == 0:
        ans = 'Yes'
    if a[0][i]+a[1][i]+a[2][i] == 0:
        ans = 'Yes'
if a[0][0]+a[1][1]+a[2][2] == 0 or a[2][0]+a[1][1]+a[0][2] == 0:
    ans = 'Yes'
print(ans)

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)]
for i in range(3):
  for j in range(3):
    for k in range(3):
      if a[i][j] == b[k]:
          a[i][j] = 0
ans = 'No'
for i in range(3):
  if a[i][0]+a[i][1]+a[i][2] == 0:
      ans = 'Yes'
  if a[0][i]+a[1][i]+a[2][i] == 0:
      ans = 'Yes'
if a[0][0]+a[1][1]+a[2][2] == 0 or a[2][0]+a[1][1]+a[0][2] == 0:
    ans = 'Yes'
print(ans)

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)]
for i in range(3):
  for j in range(3):
    for k in range(3):
      if a[i][j] == b[k]:
        a[i][j] = 0
ans = 'No'
for i in range(3):
  if a[i][0]+a[i][1]+a[i][2] == 0:
    ans = 'Yes'
  if a[0][i]+a[1][i]+a[2][i] == 0:
    ans = 'Yes'
if a[0][0]+a[1][1]+a[2][2] == 0 or a[2][0]+a[1][1]+a[0][2] == 0:
  ans = 'Yes'
print(ans)

Submission status: Wrong Answer

Solution code:
a = list(map(str,input().split()))
b = list(map(str,input().split()))
c = list(map(str,input().split()))
n = int(input())
for i in range(1,n+1):
  b_i = int(input())
  
for i in range(1,n+1):
  d = [" " if 'b_i' in s else s for s in a]
  e = [" " if 'b_i' in s else s for s in b]
  f = [" " if 'b_i' in s else s for s in c]
if d[0]==d[1]==d[2] or e[0]==e[1]==e[2] or f[0]==f[1]==f[2] or d[0]==e[0]==f[0] or d[1]==e[1]==f[1] or d[2]==e[2]==f[2] or d[0]==e[1]==f[2] or d[2]==e[1]==f[0]:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
A=[[int(x) for x in input().split()]for i in range(3)]
N = int(input())
b=list(map(int,input().split()))
 
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()
for i in range(3):
    if 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:
    print('Yes')
    exit()
if A[2][0] in b and A[1][1] in b and A[0][2] in b:
    print('Yes')
    exit() 
print('No')

Submission status: Wrong Answer

Solution code:
A=[[int(x) for x in input().split()]for i in range(3)]
n=int(input())
b=list(map(int,input().split()))
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()
for i in range(3):
    if 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:
    print('Yes')
    exit()
if A[2][0] in b and A[1][1] in b and A[0][2] in b:
    print('Yes')
    exit()
print('No')

Submission status: Wrong Answer

Solution code:
A=[[int(x) for x in input().split()]for i in range(3)]
n=int(input())
b=list(map(int,input().split()))
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:
    print('Yes')
    exit()
if A[2][0] in b and A[1][1] in b and A[0][2] in b:
    print('Yes')
    exit()
print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=[[int(x) for x in input().split()] for i in range(3)]
n=int(input())
b=list(map(int,input().split()))
for i in b:
  for j in a:
    if i==j:
      j=0
if a[0][0]==a[0][1]==a[0][2] or a[1][0]==a[1][1]==a[1][2] or a[2][0]==a[2][1]==a[2][2] or 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] or a[0][0]==a[1][1]==a[2][2] or a[2][0]==a[1][1]==a[0][2]:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))

al = a1+a2+a3
n =int(input())

for i in range(n):
    b = int(input())
    if b == al:
        al[al.index()] = 0
if al[0] + al[1] + al[2] == 0 or al[3] + al[4] + al[5] == 0 or al[6] + al[7] + al[8] == 0 or al[0] + al[3] + al[6] == 0 or al[1] + al[4] + al[7] == 0 or al[2] + al[5] + al[8] == 0 or al[0] + al[4] + al[8] == 0 or al[2] + al[4] + al[6] == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))

al = a1+a2+a3
n =int(input())

for i in range(n):
    b = int(input())
    if b == al:
        al[al.index()] = 0
if a1[0] + a1[1] + a1[2] == 0 or a2[0] + a2[1] + a2[2] == 0 or a3[0] + a3[1] + a3[2] == 0 or a1[0] + a2[0] + a3[0] == 0 or a1[1] + a2[1] + a3[1] == 0 or a1[2] + a2[2] + a3[2] == 0 or a1[0] + a2[1] + a3[2] == 0 or a1[2] + a2[1] + a3[0] == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))

al = a1+a2+a3
n =int(input())

for i in range(n):
    b = int(input())
    if b == al:
        al[al.index()] = 0
if a1[0] + a1[1] + a1[2] == 0 or a2[0] + a2[1] + a2[2] or a3[0] + a3[1] + a3[2] or a1[0] + a2[0] + a3[0] or a1[1] + a2[1] + a3[1] or a1[2] + a2[2] + a3[2] or a1[0] + a2[1] + a3[2] or a1[2] + a2[1] + a3[0]:
    print("Yes")
else:
    print("No")