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 _ in range(3):
    a.append(list(map(int, input().split())))

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

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

Submission status: Wrong Answer

Solution code:
list = []
for i in range(3):
  tmp = input().split()
  list.append(tmp)

n = int(input())
for i in range(n):
  tmp = int(input())
  loop_break = False
  for j in range(3):
    for k in range(3):
      if list[j][k] == tmp:
        list[j][k] = 0
        loop_break = True
        break
    if loop_break == True:
      break
for i in range(3):
  if list[i][0] == 0:
    if list[i][0] == list[i][1] and list[i][1] == list[i][2]:
      print('Yes')
      quit()
  if list[0][i] == 0:
    if list[0][i] == list[1][i] and list[1][i] == list[2][i]:
      print('Yes')
      quit()
if list[1][1] == 0:
  if list[0][0] == 0 and list[2][2] == 0:
    print('Yes')
    quit()
  if list[0][2] == 0 and list[2][0] == 0:
    print('Yes')
    quit()
print('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 x in range(3):
        for y in range(3):
            if A[x][y] == b:
                A[x][y] = -1

for x in range(3):
    f = True
    for y in range(3):
        if A[x][y] != -1:
            f = False
    if f:
        print("Yes")
        exit()

for x in range(3):
    f = True
    for y in range(3):
        if A[y][x] != -1:
            f = False
    if f:
        print("Yes")
        exit()

for x in range(3):
    f = True
    if A[x][x] != -1:
        f = False

if f:
    print("Yes")
    exit()

for x in range(3):
    f = True
    if A[2 - x][x] != -1:
        f = False

if f:
    print("Yes")
    exit()

print("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 x in range(3):
        for y in range(3):
            if A[x][y] == b:
                A[x][y] = -1

for x in range(3):
    f = True
    for y in range(3):
        if A[x][y] != -1:
            f = False
    if f:
        print("Yes")
        exit()

for x in range(3):
    f = True
    for y in range(3):
        if A[y][x] != -1:
            f = False
    if f:
        print("Yes")
        exit()

for x in range(3):
    f = True
    if A[x][x] != -1:
        f = False

    if f:
        print("Yes")
        exit()

for x in range(3):
    f = True
    if A[2 - x][x] != -1:
        f = False

    if f:
        print("Yes")
        exit()

print("No")

Submission status: Wrong Answer

Solution code:
import sys
import math
from io import StringIO
import unittest

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

def resolve():
    table = [int(s) for s in input().split()]
    table += [int(s) for s in input().split()]
    table += [int(s) for s in input().split()]

    lis = [int(input()) for _ in range(int(input()))]

    ans = [ n in lis for n in table ]

    for line in lines:
        valid = True
        for num in line:
            if not ans[num] :
                valid = False
                break

        if valid:
            print('Yes')
            return

    print('No')

resolve()

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):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[y][x]:
        A[y][x]=-1
for x in range(3):
  f=True
  for y in range(3):
    if A[y][x]!=-1:
      f=False
      if f:
        print('Yes')
        exit()
for y in range(3):
  f=True
  for x in range(3):
    if A[y][x]!=-1:
      f=False
      if f:
        print('Yes')
        exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
  exit()
f=True
for i in range(3):
  if A[2-i][i]!=-1:
    f=False
if f:
  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())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[y][x]:
        A[y][x]=-1
for x in range(3):
  f=True
  for y in range(3):
    if A[y][x]!=-1:
      f=False
      if f:
        print('Yes')
        exit()
for y in range(3):
  f=True
  for x in range(3):
    if A[y][x]!=-1:
      f=False
      if f:
        print('Yes')
        exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
  exit()
f=True
for i in range(3):
  if A[i][2-i]!=-1:
    f=False
if f:
  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())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  f=True
  for y in range(3):
    if A[x][y]!=-1:
      f=False
      if f:
        print('Yes')
        exit()
for y in range(3):
  f=True
  for x in range(3):
    if A[x][y]!=-1:
      f=False
      if f:
        print('Yes')
        exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
  exit()
f=True
for i in range(3):
  if A[i][2-i]!=-1:
    f=False
if f:
  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())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  f=True
  for y in range(3):
    if A[x][y]!=-1:
      f=False
      if f:
        print('Yes')
        exit()
for y in range(3):
  f=True
  for x in range(3):
    if A[y][x]!=-1:
      f=False
      if f:
        print('Yes')
        exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
  exit()
f=True
for i in range(3):
  if A[i][2-i]!=-1:
    f=False
if f:
  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())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  if A[x][0]==-1:
    f=True
    for y in range(3):
      if A[x][y]!=-1:
        f=False
        if f:
          print('Yes')
          exit()
for y in range(3):
  if A[0][y] == -1:
    f=True
    for x in range(3):
      if A[y][x]!=-1:
        f=False
        if f:
          print('Yes')
          exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
  exit()
f=True
for i in range(3):
  if A[i][2-i]!=-1:
    f=False
if f:
  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())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  if A[x][0]==-1:
    f=True
    for y in range(3):
      if A[x][y]!=-1:
        f=False
        if f:
          print('Yes')
          exit()
for y in range(3):
  if A[0][y] == -1:
    f=True
    for x in range(3):
      if A[y][x]!=-1:
        f=False
        if f:
          print('Yes')
          exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
  exit()
f=True
for i in range(1,4):
  if A[-i][-i]!=-1:
    f=False
if f:
  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())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  if A[x][0]==-1:
    f=True
    for y in range(3):
      if A[x][y]!=-1:
        f=False
        if f:
          print('Yes')
          exit()
for y in range(3):
  if A[0][y] == -1:
    f=True
    for x in range(3):
      if A[y][x]!=-1:
        f=False
        if f:
          print('Yes')
          exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
  exit()
f=True
for i in range(1,3):
  if A[-i][-i]!=-1:
    f=False
if f:
  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())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  if A[x][0]==-1:
    f=True
    for y in range(3):
      if A[x][y]!=-1:
        f=False
        if f:
          print('Yes')
          exit()
for y in range(3):
  if A[0][y] == -1:
    f=True
    for x in range(3):
      if A[y][x]!=-1:
        f=False
        if f:
          print('Yes')
          exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
f=True
for i in range(1,3):
  if A[-i][-i]!=-1:
    f=False
if f:
  print('Yes')

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):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  if A[x][0]==-1:
    f=True
    for y in range(3):
      if A[x][y]!=-1:
        f=False
    if f:
      print('Yes')
      exit()
for y in range(3):
  if A[0][y] == -1:
    f=True
    for x in range(3):
      if A[y][x]!=-1:
        f=False
    if f:
      print('Yes')
      exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
f=True
for i in range(1,3):
  if A[-i][-i]!=-1:
    f=False
if f:
  print('Yes')

Submission status: Wrong Answer

Solution code:
s = 3
arr =[]
for _ in range(s):
        arr.append(list(map(int, input().rstrip().split())))
print(arr)

check = [[0,0,0],[0,0,0],[0,0,0]]
#print(check)

#check データ
N = int(input())
#print(N)

for i in range(N):
    data = int(input())
    for k in range(3):
        for j in range(3):
            if data == arr[j][k]:
                check[j][k]= 1
#print(check)

#chek ビンゴ
answer = "No"
for k in range(3):
    if check[k][0] == 1 and check[k][1]== 1 and check[k][2] == 1:
        answer = "Yes"

for j in range(3):
    if check[0][j] == 1 and check[1][j] == 1 and check[2][j] == 1:
        answer = "Yes"

if check[0][0] == 1 and check[1][1] == 1 and check[2][2] == 1:
    answer = "Yes"

if check[0][2] == 1 and check[1][1] == 1 and check[2][0] == 1:
    answer = "Yes"


print(answer)

Submission status: Wrong Answer

Solution code:
row1=list(map(int,input().split()))
row2=list(map(int,input().split()))
row3=list(map(int,input().split()))
bingo=row1+row2+row3
num=int(input())
num_list=set()
for i in range(num):
  num_list.add(int(input()))

bingo_list=[[0,3,6],[1,4,7],[2,5,8],[0,1,2],[3,4,5],[6,7,8],[0,4,8],[2,4,6]]
num_list=list(num_list)
for i in num_list:
  if i in bingo:
    bingo[bingo.index(i)] = True

for i in bingo_list:
  if bingo[i[0]] ==True and bingo[i[1]] == True and bingo[i[2]] == True:
    print('Yes')
    break
  if bingo_list.index(i) == len(bingo_list):
    print('No')

Submission status: Wrong Answer

Solution code:
row1=list(map(int,input().split()))
row2=list(map(int,input().split()))
row3=list(map(int,input().split()))
bingo=row1+row2+row3
num=int(input())
num_list=set()
for i in range(num):
  num_list.add(int(input()))

bingo_list=[[0,3,6],[1,4,7],[2,5,8],[0,1,2],[3,4,5],[6,7,8],[0,4,8],[2,4,6]]
num_list=list(num_list)
for i in num_list:
  if i in bingo:
    bingo[bingo.index(i)] = True

for i in bingo_list:
  if bingo[i[0]] ==True and bingo[i[1]] == True and bingo[i[2]] == True:
    print('Yes')
    break

print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np

A = []
for _ in range(3):
    A.append(list(map(int, input().split())))
N = input()
N = int(N)
B = []
for _ in range(N):
    b = input()
    B.append(int(b))
npA = np.array(A)
check = 'no'
for a in npA:
    if a[0] in B and a[1] in B and a[2] in B:
        check = 'yes'
for a in npA.T:
    if a[0] in B and a[1] in B and a[2] in B:
        check = 'yes'
dia = np.diag(npA)
if dia[0] in B and dia[1] in B and dia[2] in B:
    check = 'yes'
diaT = np.diag(np.fliplr(npA))
if diaT[0] in B and diaT[1] in B and diaT[2] in B:
    check = 'yes'
print(check)

Submission status: Wrong Answer

Solution code:
x, y, z = input().split()
a, b, c = input().split()
d, e, f = input().split()
N = int(input())
for i in range(1, N+1):
    i = input()
    if i == x or i == y or i == z or i == a or i == b or i ==c or i == d or i == e or i == f:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
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()))

for i,a in enumerate(A):
  for j,x in enumerate(a):
    if x in B:
      A[i][j] = 0

def bingo(x):
  if sum(x) == 0:
    print('Yes')
    exit()

for x in A:
  bingo(x)

AT = [list(x) for x in zip(*A)]
for x in AT:
  bingo(x)

AD = [A[i][i] for i in range(3)]
bingo(AD)

AD = [A[2-i][2-i] for i in range(3)]
bingo(AD)

print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
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()))

for i,a in enumerate(A):
  for j,x in enumerate(a):
    if x in B:
      A[i][j] = 0

def bingo(x):
  if sum(x) == 0:
    print('yes')
    exit()

for x in A:
  bingo(x)

AT = [list(x) for x in zip(*A)]
for x in AT:
  bingo(x)

AD = [A[i][i] for i in range(3)]
bingo(AD)

AD = [A[2-i][2-i] for i in range(3)]
bingo(AD)

print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
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()))

def bingo(X):
  for x in X:
    if sum(x) == 0:
      return 1
  return 0

if bingo(A):
  print('yes')
  exit()

AT = []
for x in [list(x) for x in zip(*A)]:
  AT.append(x)  

if bingo(AT):
  print('yes')
  exit()

AD = []
AD1 = [0]*3
AD2 = [0]*3
for i,x in enumerate(A):
  AD1[i] = x[i]
  AD2[i] = x[2-i]
AD.append(AD1)
AD.append(AD2)

if bingo(AD):
  print('yes')
  exit()

print('No')

Submission status: Wrong Answer

Solution code:
import numpy as np
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()))

def bingo(X):
  for x in X:
    if sum(x) == 0:
      return 1
  return 0

for i,a in enumerate(A):
  for j,x in enumerate(a):
    if x in B:
      A[i][j] = 0

if bingo(A):
  print('yes')
  exit()

AT = []
for x in [list(x) for x in zip(*A)]:
  AT.append(x)  

if bingo(AT):
  print('yes')
  exit()

AD = []
AD1 = [0]*3
AD2 = [0]*3
for i,x in enumerate(A):
  AD1[i] = x[i]
  AD2[i] = x[2-i]
AD.append(AD1)
AD.append(AD2)

if bingo(AD):
  print('yes')
  exit()

print('No')

Submission status: Wrong Answer

Solution code:
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
t = []
t.append(A);t.append(B);t.append(C)
N = int(input()) 
num = [(int(input())) for x in range(N)]
for i in range(3):
  if t[i][0] in num and t[i][1] in num and t[i][2] in num:
    print('Yes')
    exit()
  if t[0][i] in num and t[1][i] in num and t[2][i] in num:
    print('Yes')
    exit()
if (t[0][0] in num and t[1][1] in num and t[2][2] in num) or (t[0][2] in num and t[1][1] in num and t[2][1] in num):
  print('Yes')
  exit()
print('No')

Submission status: Wrong Answer

Solution code:
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
t = []
t.append(A);t.append(B);t.append(C)
N = int(input()) 
num = [(int(input())) for x in range(N)]
for i in range(3):
  if t[i][0] in num and t[i][1] in num and t[i][2] in num:
    print('Yes')
    exit()
  if t[0][i] in num and t[1][i] in num and t[2][i] in num:
    print('Yes')
    exit()
if (t[0][0] in num and t[1][1] in num and t[2][2] in num) or (t[0][2] in num and t[1][2] in num and t[2][1] in num):
  print('Yes')
  exit()
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 = int(input())
numbers = list()
for i in range(N):
    numbers.append(int(input()))

bingo = False
for a in A:
    if a not in numbers:
        break
else:
    bingo = True

for b in B:
    if b not in numbers:
        break
else:
    bingo = True

for c in C:
    if c not in numbers:
        break
else:
    bingo = True

columnA = [A[0],B[0],C[0]]
for i in columnA:
    if i not in numbers:
        break
else:
    bingo = True

columnB = [A[1],B[1],C[1]]
for i in columnB:
    if i not in numbers:
        break
else:
    bingo = True

columnC = [A[2],B[2],C[2]]
for i in columnB:
    if i not in numbers:
        break
else:
    bingo = True

diagA = [A[0],B[1],C[2]]
for i in diagA:
    if i not in numbers:
        break
else:
    bingo = True

diagB = [A[2],B[1],C[0]]
for i in diagB:
    if i not in numbers:
        break
else:
    bingo = True

print("Yes" if bingo else "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 = int(input())
numbers = list()
for i in range(N):
    numbers.append(int(input()))

bingo = False
for a in A:
    if a not in numbers:
        break
else:
    bingo = True

for b in B:
    if b not in numbers:
        break
else:
    bingo = True

for c in C:
    if c not in numbers:
        break
else:
    bingo = True

columnA = [A[0],B[0],C[0]]
for i in columnA:
    if i not in numbers:
        break
else:
    bingo = True

columnB = [A[1],B[1],C[1]]
for i in columnB:
    if i not in numbers:
        break
else:
    bingo = True

columnC = [A[2],B[2],C[2]]
for i in columnB:
    if i not in numbers:
        break
else:
    bingo = True

diagA = [A[0],B[1],C[2]]
for i in diagA:
    if i not in numbers:
        break
else:
    bingo = True

diagB = [A[0],B[1],C[2]]
for i in diagB:
    if i not in numbers:
        break
else:
    bingo = True

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

Submission status: Wrong Answer

Solution code:
a = [input().split() for _ in range(3)]
n = int(input())
b = [input() for _ in range(n)]

p = []
p += a
p += [list(a_) for a_ in zip(*a)]
p += [[a[x][x] for x in range(3)]]
p += [[a[x][2-x] for x in range(3)]]

for p_ in p:
    for x in p_:
        if x in b:
            continue
        else:
            break
    else:
        print('Yes')
else:
    print('No')

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())
lis = [a, b, c, d, e, f, g, h, i]
n = int(input())
ans = 0
for i in range(n):
    x = int(input())
    for item in lis:
        if item == x:
            ans = 1
print("Yes") if ans == 1 else print("No")

Submission status: Wrong Answer

Solution code:
def no():
    a=input()
    a1=a.split()
    b=input()
    b1=b.split()
    c=input()
    c1=c.split()
    l=[a1,b1,c1]
    l1=[]
    n=int(input())
    for i in range(n):
        w=input()
        l1.append(w)
    if l[0][0]  and l[0][1] and l[0][2] in l1:
        return "Yes"
    elif l[1][0]  and l[1][1] and l[1][2] in l1:
        return "Yes"
    elif l[2][0]  and l[2][1] and l[2][2] in l1:
        return "Yes"
    elif l[0][0] and l[1][0] and l[2][0] in l1:
        return "Yes"
    elif l[0][1] and l[1][1] and l[2][1] in l1:
        return "Yes"
    elif l[0][2] and l[1][2] and l[2][2] in l1:
        return "Yes"
    elif l[0][0] and l[1][1] and l[2][2] in l1:
        return "Yes"
    elif l[0][2] and l[1][1] and l[2][0] in l1:
        return "Yes"
    else:
        return "No"
print(no())

Submission status: Wrong Answer

Solution code:
A1=[int(e) for e in input().split()]
A2=[int(e) for e in input().split()]
A3=[int(e) for e in input().split()]
N=int(input())
for i in range(N):
    b=input()
    for j in range(3):
        if b==A1[j]:
            A1[j]= -1
        elif b==A2[j]:
            A2[j]= -1
        elif b==A3[j]:
            A3[j]= -1
if A1[0]==A2[0] and A2[0]==A3[0]:
    print('Yes')
elif A1[1]==A2[1] and A2[1]==A3[1]:
    print('Yes')
elif A1[2]==A2[2] and A2[2]==A3[2]:
    print('Yes')
elif A1[0]==A1[1] and A1[1]==A1[2]:
    print('Yes')
elif A2[0]==A2[1] and A2[1]==A2[2]:
    print('Yes')
elif A3[0]==A3[1] and A3[1]==A3[2]:
    print('Yes')
elif A1[0]==A2[1] and A2[1]==A3[2]:
    print('Yes')
elif A1[2]==A2[1] and A2[1]==A3[0]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
card = []
s  = {}
for i in range(3):
    row = list(map(int, input().split(" ")))
    card.append(row)
    s[row[0]] = [i, 0]
    s[row[1]] = [i, 1]
    s[row[2]] = [i, 2]
N = int(input())
for i in range(N):
    b = int(input())
    if b not in s:
        continue
    else:
        loc = s[b]
        card[loc[0]][loc[1]] = 0
if card[0][0] == 0 and card[1][1] == 0 and card[2][2] == 0:
    print("Yes")
elif (card[0][0] == 0 and card[0][1] == 0 and card[0][2] == 0) or (card[1][0] == 0 and card[1][1] == 0 and card[1][2] == 0) or (card[2][0] == 0 and card[2][1] == 0 and card[2][2] == 0):
    print("Yes")
elif (card[0][0] == 0 and card[1][0] == 0 and card[2][0] == 0) or (card[0][1] == 0 and card[1][1] == 0 and card[2][1] == 0) or (card[0][2] == 0 and card[1][2] == 0 and card[2][2] == 0):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
field = [[0]*3 for _ in range(3)]

for x in range(3):
    for y in range(3):
        field[x][y] = 0

def is_bingo(f):
    fl_v = [0 for _ in range(3)]
    fl_h = [0 for _ in range(3)]
    for i in range(3):
        for j in range(3):
            if f[i][j] == 1:
                fl_v[j]+=1
    if max(fl_v)==3:
        return True
    for i in range(3):
        for j in range(3):
            if f[i][j] == 1:
                fl_v[i]+=1
    if max(fl_h)==3:
        return True

    if f[0][0] == 1 and f[1][1] == 1 and f[2][2] == 1:
        return True

    if f[0][2] == 1 and f[1][1] == 1 and f[2][0] == 1:
        return True

    return False

bingo_num = [(-1,-1) for _ in range(101)]

for x in range(3):
    ax = list(map(int,input().split()))
    for y in range(3):
        bingo_num[ax[y]] = (x,y)

n = int(input())

for x in range(n):
    bn = bingo_num[int(input())]
    field[bn[0]][bn[1]] = 1

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

Submission status: Wrong Answer

Solution code:
bingo=[input().split(' ') for _ in range(3)]

#print(bingo)
N=int(input())
get=[input() for _ in range(N)]
#print(get)

for i in range(3):
    for j in range(3):
        if bingo[i][j] in get:
            bingo[i][j] = 'A'

#print(bingo)

if bingo[0][0]==bingo[0][1]==bingo[0][2]:
    print('Yes')
elif bingo[1][0]==bingo[1][1]==bingo[1][2]:
    print('Yes')
elif bingo[2][0]==bingo[2][1]==bingo[2][2]:
    print('Yes')
elif bingo[0][0]==bingo[1][0]==bingo[2][0]:
    print('Yes')
elif bingo[0][1]==bingo[1][1]==bingo[2][1]:
    print('Yes')
elif bingo[0][2]==bingo[1][2]==bingo[2][2]:
    print('Yes')
elif bingo[0][0]==bingo[1][1]==bingo[2][2]:
    print('Yes')
elif bingo[2][2]==bingo[1][1]==bingo[0][0]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
card = []
for i in range(3):
    a1,a2,a3 = map(int,input().split())
    card.append([a1,a2,a3])
print(card)

n = int(input())

for i in range(n):
    num = int(input())
    for j in [0,1,2]:
        for k in [0,1,2]:
         if num == card[j][k]:
             card[j][k] = 0
if card[0] == [0,0,0] or card[1] == [0,0,0] or card[2] == [0,0,0]:
    print('Yes')
elif [card[i][0] for i in range(3)] == [0,0,0] or [card[i][1] for i in range(3)] == [0,0,0] or [card[i][2] for i in range(3)] == [0,0,0]:
    print('Yes')
elif [card[0][0],card[1][1],card[2][2]] == [0,0,0] or [card[0][2],card[1][1],card[2][0]] == [0,0,0]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
x1   = list(map(int, input().split()))
x2   = list(map(int, input().split()))
x3   = list(map(int, input().split()))
card = [x1, x2, x3]

numLen  = int(input())
numList = [int(input()) for _ in range(numLen)]
ans = "No"
for x in range(3):
    for y in range(3):
        for numList_i in range(numLen):
            if card[x][y] == numList[numList_i]:
                print(numList[numList_i])
                card[x][y] = "x"

for i in range(3):
    if card[i][0] == "x" and card[i][1] == "x" and card[i][2] == "x":
        ans = "Yes"
    if card[0][i] == "x" and card[1][i] == "x" and card[2][i] == "x":
        ans = "Yes"

if card[0][0] == "x" and card[1][1] == "x" and card[2][2] == "x":
    ans = "Yes"
if card[0][2] == "x" and card[1][1] == "x" and card[2][0] == "x":
    ans = "Yes"
print(ans)

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)]
# X = list(map(int, input().split()))
# n, k = map(int, input().split())
# p = math.ceil(sum(X)/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 = False
# 横軸を確認
for i in range(3):
    cnt = 0
    for j in range(3):
        cnt += A[i][j]
    if cnt == 0:
        ans = True
# 縦軸を確認
for i in range(3):
    cnt = 0
    for j in range(3):
        cnt += A[j][i]
    if cnt == 0:
        ans = True
# 斜めの確認
cnt = 0
for i in range(3):
    cnt += A[i][i]
if cnt == 0:
    ans = True

cnt_2 = 0
for i in range(3):
    cnt += A[i][2-i]
if cnt == 0:
    ans = True

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

Submission status: Wrong Answer

Solution code:
import numpy as np

A = np.empty(9)
b = np.empty(10)
place = ''

for i in range(0,7,3):
  A[i], A[i+1], A[i+2] = map(int,input().split())

N = int(input())

for n in range(N):
  b[n] = int(input())
  for j in range(9):
  	if b[n] == A[j]:
  		place = place + ' ' + str(j)

ans='No'

for i in range(0,7,3):
  if str(i) and str(i+1) and str(i+2) in place:
  	ans = 'Yes'

for i in range(3):
  if str(i) and str(i+3) and str(i+6) in place:
  	ans = 'Yes'

if '0' and '4' and '8' in place:
	ans = 'Yes'
if '2' and '4' and '6' in place:
	ans = 'Yes'

print(ans)

Submission status: Wrong Answer

Solution code:
d,e,f=input().split( )
g,h,i=input().split( )
j,k,l=input().split( )
N=int(input())
b=[0]*N
for k in range(N):
 b[k]=int(input())

a=[[-1,-2,-3],[-4,-5,-6],[-7,-8,-9]]
for k in range(N):
 if b[k]==d:a[0][0]=0
 if b[k]==e:a[0][1]=0
 if b[k]==f:a[0][2]=0
 if b[k]==g:a[1][0]=0
 if b[k]==h:a[1][1]=0
 if b[k]==i:a[1][2]=0
 if b[k]==j:a[2][0]=0
 if b[k]==k:a[2][1]=0
 if b[k]==l:a[2][2]=0

c=1
for i in range(3):
 if a[i][0]==a[i][1]==a[i][2]:c=0
 elif a[0][i]==a[1][i]==a[2][i]:c=0

if a[0][0]==a[1][1]==a[2][2]:c=0
if a[0][2]==a[1][1]==a[2][0]:c=0

if c==0:print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
d,e,f=(int(x) for x in input().split( ))
g,h,i=(int(x) for x in input().split( ))
j,k,l=(int(x) for x in input().split( ))
N=int(input())
b=[0]*N
for k in range(N):
 b[k]=int(input())

a=[[-1,-2,-3],[-4,-5,-6],[-7,-8,-9]]
for k in range(N):
 if b[k]==d:a[0][0]=0
 if b[k]==e:a[0][1]=0
 if b[k]==f:a[0][2]=0
 if b[k]==g:a[1][0]=0
 if b[k]==h:a[1][1]=0
 if b[k]==i:a[1][2]=0
 if b[k]==j:a[2][0]=0
 if b[k]==k:a[2][1]=0
 if b[k]==l:a[2][2]=0

c=1
for i in range(3):
 if a[i][0]==a[i][1]==a[i][2]:c=0
 elif a[0][i]==a[1][i]==a[2][i]:c=0

if a[0][0]==a[1][1]==a[2][2]:c=0
if a[0][2]==a[1][1]==a[2][0]:c=0

if c==0:print("Yes")
else:print("No")

Submission status: Wrong Answer

Solution code:
m = []
for _ in range(3):
	m.append(list(map(int, input().split())))
n = int(input())
nums = set()
for _ in range(n):
	nums.add(int(input()))

flag = True
#Row
for r in m:
	count = 0
	for elem in r:
		if elem in nums:
			count += 1
	if (count == len(r)):
		flag = False
		break

if flag:
	for r in zip(*m):
		count = 0
		for elem in r:
			if elem in nums:
				count += 1
		if (count == len(r)):
			flag = False
			break
if flag:
	count = 0
	for i in range(3):
		if m[i][i] in nums:
			count += 1
	if (count == 3):
		flag = False
if flag:
	print("No")
else:
	print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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