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: Runtime Error

Solution code:
bingo = []
bingo[0] , bingo[1] , bingo[2] = map(int, input().split())
bingo[3] , bingo[4], bingo[5] = map(int, input().split())
bingo[6], bingo[7], bingo[8] = map(int, input().split())
n = int(input())
ls = []
counter = 0
for i in range(n):
  ls[i] = int(input())

for i in range(len(bingo)):
  for j in range(len(ls)):
    if ls[j] == bingo[i]:
      bingo[i] = 0
      break
for i in range(len(bingo)):
  if i == 0:
    if bingo[i] + bingo[i+1] + bingo[i+2] == 0:
      counter += 1
      break
    elif bingo[i] + bingo[i+3] + bingo[i+6] == 0:
      counter += 1
      break
    elif bingo[i] + bingo[i+4] + bingo[i+8] == 0:
      counter += 1
      break
  elif i == 1:
    if bingo[i] + bingo[i+3] + bingo[i+6] == 0:
      counter += 1
      break
  elif i == 2:
    if bingo[i] + bingo[i+3] + bingo[i+6] == 0:
      counter += 1
      break
    elif bingo[i] + bingo[i+2] + bingo[i+4] == 0:
      counter += 1
      break
  elif i == 3:
    if bingo[i] + bingo[i+1] + bingo[i+2] == 0:
      counter += 1
      break
  elif i == 6:
    if bingo[i] + bingo[i+1] + bingo[i+2] == 0:
      counter += 1
      break
if counter > 0:
  print("Yes")
else: 
  print("No")

Submission status: Runtime Error

Solution code:
a = [list(map(int, input().split())) for i in range(3)]
 
num = int(input())
for i in range(num):
  now = int(input())
  for i in range(3):
    for j in range(3):
      if(a[i][j] == now):
        a[i][j] = 0
str = 'No'
for j in range(3):
  a1, a2 = 0, 0
  for i in range(3):
    if(a[i][j] != 0):
      a1 = -1
    if(a[j][i] != 0):
      a2 = -1
    if(a1 == -1 and a2 == -1 and a3 == -1 and a4 == -1):
      print('No')
      exit()
  if(a[j][j] != 0):
    a3 = -1
  if(a[j][2-j] != 0):
    a4 = -1
if(a1 == -1 and a2 == -1 and a3 == -1 and a4 == -1):
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
import numpy as np
import sys

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


row = np.sum(A, axis=1)
for i in range(3):
    if row[i] == 0:
        print('Yes')
        sys.exit()


col = np.sum(A, axis=0)
for i in range(3):
    if col[i] == 0:
        print('Yes')
        sys.exit()

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

c = 0
for i in range(3):
    c += A[3-i-1][i]
if c == 0:
    print('Yes')
    sys.exit()

print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
matrix = [] 
ans="Yes"
for i in range(3):
  list1=list(map(int,input().split()))
  matrix.append(list1)
N = int(input())
for k in range(N):
  num=int(input())
	for i in range(3):
 		for j in range(3):
    		if matrix[i][j]==num:
              matrix[i][j]=0
if (matrix[0][0] ==0 and matrix[0][1]==0 and matrix[0][2]==0):
  print(ans)
elif (matrix[1][0] ==0 and matrix[1][1]==0 and matrix[1][2]==0):
  print(ans)
elif (matrix[2][0] ==0 and matrix[2][1]==0 and matrix[2][2]==0):
  print(ans)
elif (matrix[0][1] ==0 and matrix[0][2]==0 and matrix[0][0]==0):
  print(ans)
elif (matrix[1][0] ==0 and matrix[1][1]==0 and matrix[1][1]==0):
  print(ans)
elif (matrix[2][0] ==0 and matrix[2][1]==0 and matrix[2][2]==0):
  print(ans)
elif (matrix[0][0] ==0 and matrix[1][1]==0 and matrix[2][2]==0):
  print(ans)
elif (matrix[2][0] ==0 and matrix[1][1]==0 and matrix[0][2]==0):
  print(ans)
else:
  print("No")

Submission status: Runtime Error

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

n = int(input())

nums = [[] for _ in range(3)]

check = list()

for i in range(3):
    for j in range(3):
        check[i].append(False)
        if bingo[i][j] in nums:
            check[i][j] = True

ANS = "No"

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

print(ANS)

Submission status: Runtime Error

Solution code:
a=[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]=-1
for i in range(3):
  if a[i][0]==a[i][1]==a[i][2]==-1:
    print('Yes')
    exit()
  if a[0][i]==a[1][i]==a[2][i]==-1:
    print('Yes')
    exit()
if a[0][0]==a[1][1]==a[2][2]==-1 or a[0][2]==a[1][1]==a[2][0]==-1:
  print('Yes')
  exit()
print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a = [map(int,input().split()) for a in range(3)]
a1 = [a[0][0],a[0][1],a[0][2]]
a2 = [a[1][0],a[1][1],a[1][2]]
a3 = [a[2][0],a[2][1],a[2][2]]
a4 = [a[0][0],a[1][1],a[2][2]]
a5 = [a[0][2],a[1][1],a[2][0]]
a6 = [a[0][0],a[1][0],a[2][0]]
a7 = [a[0][1],a[1][1],a[2][1]]
a8 = [a[0][2],a[1][2],a[2][2]]
n = int(input())
B = [int(input()) for i in range(n)]
if set(a1) <= set(B) or set(a2) <= set(B) or set(a3) <= set(B) or set(a4) <= set(B) or set(a5) <= set(B) or set(a6) <= set(B) or set(a7) <= set(B) or set(a8) <= set(B):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a = [input().split() for a in range(3)]
a1 = [a[0][0],a[0][1],a[0][2]]
a2 = [a[1][0],a[1][1],a[1][2]]
a3 = [a[2][0],a[2][1],a[2][2]]
a4 = [a[0][0],a[1][1],a[2][2]]
a5 = [a[0][2],a[1][1],a[2][0]]
a6 = [a[0][0],a[1][0],a[2][0]]
a7 = [a[1][0],a[1][1],a[2][1]]
a8 = [a[2][0],a[2][1],a[2][2]]
n = int(input())
B = [int(input()) for i in range(n)]
if set(a1) <= B or set(a2) <= B or set(a3) <= B or set(a4) <= B or set(a5) <= B or set(a6) <= B or set(a7) <= B or set(a8) <= B:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a = [input().split() for l in range(3)]
a = [[int(item) for item in row] for row in a]
N = int(input())
b = [input() for i in range(N)]

tate0 = len(set(a[0]) & set(b)) == 3
tate1 = len(set(a[1]) & set(b)) == 3
tate2 = len(set(a[2]) & set(b)) == 3
yoko0 = len(set([a[i][0] for i in range(3)]) & set(b)) == 3
yoko1 = len(set([a[i][1] for i in range(3)]) & set(b)) == 3
yoko2 = len(set([a[i][2] for i in range(3)]) & set(b)) == 3
naname0 = len(set([a[0][0],a[1][1],a[2][2]]) & set(b)) == 3
naname1 = len(set([a[0][2],a[1][1],a[2][0]]) & set(b)) == 3
if tate0 | tate1 | tate2 | yoko0 | yoko1 | yoko2 | naname0 | naname1
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
a = [input().split() for l in range(3)]
a = [[int(item) for item in row] for row in a]
N = int(input())
b = [input() for i in range(N)]
A[[1,1,1],[1,1,1],[1,1,1]]
x = 1
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
for i in range(3):
  if A[i][0]*A[i][1]*A[i][2] == 0 | A[0][i]*A[1][i]*A[2][i] == 0:
    x = 0
if A[0][0]*A[1][1]*A[2][2] == 0 | A[0][2]*A[1][1]*A[2][0] == 0:
  x = 0
if x:
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
a = [input().split() for l in range(3)]
a = [[int(item) for item in row] for row in a]
N = int(input())
b = [input() for i in range(n)]
x = 1
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
for i in range(3):
  if a[i][0]*a[i][1]*a[i][2] == 0 | a[0][i]*a[1][i]*a[2][i] == 0:
    x = 0
if a[0][0]*a[1][1]*a[2][2] == 0 | a[0][2]*a[1][1]*a[2][0] == 0:
  x = 0
if x:
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
a = [input().split() for l in range(3)]
a = [[int(item) for item in row] for row in a]
N = int(input())
b = np.zeros(N)
for i in range(N):
  b[i] = int(input())
x = 1
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
for i in range(3):
  if a[i][0]*a[i][1]*a[i][2] == 0 | a[0][i]*a[1][i]*a[2][i] == 0:
    x = 0
if a[0][0]*a[1][1]*a[2][2] == 0 | a[0][2]*a[1][1]*a[2][0] == 0:
  x = 0
if x:
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
import numpy as np
a = np.zeros((3,3))
for i in range(3):
  for j in range(3):
    a[i][j] = int(input())
A = a.T
N = int(input())
b = np.zeros(N)
for i in range(N):
  b[i] = int(input())
k = 0
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
a
c = np.array([a[0,0],a[1,1],a[2,2]])
d = np.array([a[0,2],a[1,1],a[2,0]])
k = 1
for i in range(3):
  if (a[i] == 0).any() | (A[i] == 0).any():
    k = 0
if (c == 0).any() | (d == 0).any():
  k = 0
if k:
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
import numpy as np
a = np.zeros((3,3))
for i in range(3):
  for j in range(3):
    a[i][j] = input()
A = a.T
N = input()
b = np.zeros(N)
for i in range(N):
  b[i] = input()
k = 0
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
c = np.array(a[0,0],a[1,1],a[2,2])
d = np.array(a[0,2],a[1,1],a[2,0])
k = 1
for i in range(3):
  if a[i].cumprod * A[i].cumprod == 0:
    k = 0
if c.cumprod * d.cumprod == 0:
  k = 0
if k:
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
a=[list(map(int,input().split())) for _ in range(3)]
n=int(input())
b=[int(input()) for _ in range(n)]
maze=[["*" for i in range(3)] for _ in range(3)]
for i in range(3):
    for j in range(3):
        for k in range(n):
            if b[i]==a[j][k]:
                maze[j][k]="#"
for i in range(3):
    f=1
    for j in range(3):
        if maze[i][j]!="#":
            f=0
            break
    if f:
        print("Yes")
        exit()
for i in range(3):
    fc=1
    for j in range(3):
        if maze[j][i]!="#":
            fc=0
            break
    if fc:
        print("Yes")
        exit()
for i in range(3):
    fa=1
    if maze[i][i]!="#":
        fa=0
        break
if fa:
    print("Yes")
    exit()
for i in range(3):
    fe=1
    if maze[i][2-i]!="#":
        fe=0
        break
if fe:
    print("Yes")
    exit()
print("No")

Submission status: Runtime Error

Solution code:
f=lambda a:any(all(b)for b in a)or all(a[i][i]for i in(0,1,2))   
a=eval('list(map(int,input().split())),'*3)
exec('b=int(input());a=[[u*(u!=b)for u in t]for t in a];'*int(input()))
a=[[not u for u in t]for t in a]
print('NYoe s'[f(a)|f(t[::-1]for t in zip(*a))::2])

Submission status: Runtime Error

Solution code:
for i in range(3):
    line = input().rstrip().split(' ')
    array_1.append(line)

bool_array = []
for i in range(3):
    tmp = []
    for j in range(3):
        tmp.append(False)
    bool_array.append(tmp)
num = int(input().rstrip())
for i in range(num):
    input_line = input().rstrip()
    for j in range(3):
        for k in range(3):
            if array_1[j][k] == input_line:
                bool_array[j][k] = True

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

    if bool_array[0][i] and bool_array[1][i] and bool_array[2][i]:
        ans = 'Yes'

if bool_array[0][0] and bool_array[1][1] and bool_array[2][2]:
    ans = 'Yes'

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

Submission status: Runtime Error

Solution code:
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
d = [[0]*3]*3
for i in range(3):
  for j in range(3):
    b = int(input())
    if A[i][j] == b:
      d[i][j] = 1

ans = "No"

for i in range(3):
  if sum(d[i]) == 3:
    ans = "Yes"
    break
  if sum([D[i] for D in d]) == 3:
    ans = "Yes"
    break
if sum([d[i][i] for i in range(3)]) == 3:
  ans = "Yes"

if sum([d[i][2 - i] for i in range(3)]) == 3:
  ans = "Yes"
  
print(ans)

Submission status: Runtime Error

Solution code:
def c_guess_the_number():
    N, M = [int(i) for i in input().split()]
    Conds = [[int(i) for i in input().split()] for j in range(M)]

    digit = [-1] * N
    # 同じ桁に異なる数字を割り当てている場合を検出
    for s, c in Conds:
        if digit[s - 1] not in (-1, c):
            return -1
        digit[s - 1] = c

    # N 桁目に 0 を割り当てなければならない場合
    # 基本的に N+1 桁の数となり矛盾するが、例外的に N = 1 だと 0 とすればよい。
    if digit[0] == 0:
        return -1 if N >= 2 else 0

    # 指定されなかった桁は基本的に 0 とすればよいが、N 桁目は 0 にできない。
    # 例外的に、N = 1, M = 0 だと N 桁目も 0 にできる。
    if N == 1 and M == 0:
        return 0
    for d, value in enumerate(digit):
        if value == -1:
            digit[d] = 0 if d != 0 else 1
    return ''.join(map(str, digit))

print(c_guess_the_number())

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

A = []
N = int(input())
d = list(int(input()) for i in range(N))

e = a + b
f = e + c

for i in range(N):
    if d[i] in f:
        A.append("True")

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

Submission status: Runtime Error

Solution code:
i = list(map(int, input().split()))
j = [int(0)] * 9
 
n=i[9]
 
for b in range(9):
    for c in range(n):
        if i[b]==i[10+c]:
            j.insert(b,1)    
 
if  j[0]==1 and j[3]==1 and j[6]==1\
or j[1]==1 and j[4]==1 and j[7]==1\
or j[2]==1 and j[5]==1 and j[8]==1\
or j[0]==1 and j[1]==1 and j[2]==1\
or j[3]==1 and j[4]==1 and j[5]==1\
or j[6]==1 and j[7]==1 and j[8]==1\
or j[0]==1 and j[4]==1 and j[8]==1\
or j[2]==1 and j[4]==1 and j[6]==1:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
i = list(map(int, input().split()))
j = [int(0)] * 9

n=i[9]

for b in range(9):
    for c in range(n):
        if i[b]==i[10+c]:
            j.insert(b,1)    

if  j[0]==1 and j[3]==1 and j[6]==1\
or j[1]==1 and j[4]==1 and j[7]==1\
or j[2]==1 and j[5]==1 and j[8]==1\
or j[0]==1 and j[1]==1 and j[2]==1\
or j[3]==1 and j[4]==1 and j[5]==1\
or j[6]==1 and j[7]==1 and j[8]==1\
or j[0]==1 and j[4]==1 and j[8]==1\
or j[2]==1 and j[4]==1 and j[6]==1:
    print('yes')
else:
    print('no')

Submission status: Runtime Error

Solution code:
i = list(map(int, input().split()))
j = [int(0)] * 9

n=i[9]

#print(j)

for b in range(9):
    for c in range(n):
        if i[b]==i[10+c]:
            j.insert(b,1)

#print(j)     

if  j[0]==1 and j[3]==1 and j[6]==1\
or j[1]==1 and j[4]==1 and j[7]==1\
or j[2]==1 and j[5]==1 and j[8]==1\
or j[0]==1 and j[1]==1 and j[2]==1\
or j[3]==1 and j[4]==1 and j[5]==1\
or j[6]==1 and j[7]==1 and j[8]==1\
or j[0]==1 and j[4]==1 and j[8]==1\
or j[2]==1 and j[4]==1 and j[6]==1:
    print('yes')
else:
    print('no')

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

A = [0,2,3,4,5,6,7,8,9]
N = int(input())
d = list(int(input()) for i in range(N))

e = a + b
f = e + c

d_str = [str(n) for n in d]
f_str = [str(m) for m in f]

for i in range(9):
    if f_str[i] in d_str[i]:
        A[i] = 1

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

Submission status: Runtime Error

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

A = [0,2,3,4,5,6,7,8,9]
N = int(input())
d = list(int(input()) for i in range(N))

e = a1 + a2
f = e + a3

for i in range(9):
    if str(f[i]) in str(d[i]):
        A[i] = 1

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

Submission status: Runtime Error

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

A = [0,2,3,4,5,6,7,8,9]
N = int(input())
d = list(int(input()) for i in range(N))

e = a1 + a2
f = e + a3

for i in range(N):
    if str(f[i]) in str(d[i]):
        A[i] = 1

if A[0] == A[1] == A[2] or A[3] == A[4] == A[5] or A[6] == A[7] == A[8] or A[2] == A[4] == A[6] or A[0] == A[4]== A[8]:
    print("yes")
elif A[0] == A[3] == A[6] or A[1] == A[4] == A[7] or A[2] == A[5] == A[8]:
    print("yes")
else:
    print("no")

Submission status: Runtime Error

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

A = [0,2,3,4,5,6,7,8,9]
N = int(input())
d = list(int(input()) for i in range(N))

e = a1 + a2
f = e + a3

for i in range(N):
    if str(f[i]) in str(d[i]):
        A[i] = 1

if A[0] == A[1] == A[2] or A[3] == A[4] == A[5] or A[6] == A[7] == A[8] or A[2] == A[4] == A[6] or A[0] == A[4]== A[8z]:
    print("yes")
elif A[0] == A[3] == A[6] or A[1] == A[4] == A[7] or A[2] == A[5] == A[8]:
    print("yes")
else:
    print("no")

Submission status: Runtime Error

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

A = [0,2,3,4,5,6,7,8,9]
N = int(input())
d = list(int(input()) for i in range(N))

e = a1 + a2 +a3

for i in range(N):
    if str(e[i]) in str(d[i]):
        A[i] = 1

if A[0] == A[1] == A[2] or A[3] == A[4] == A[5] or A[6] == A[7] == A[8] or A[2] == A[4] == A[6] or A[0] == A[4]== A[8z]:
    print("yes")
elif A[0] == A[3] == A[6] or A[1] == A[4] == A[7] or A[2] == A[5] == A[8]:
    print("yes")
else:
    print("no")

Submission status: Runtime Error

Solution code:
def main():
    a = [list(map(int, input().split())) for _ in range(3)]
    n = int(input())
    b = [int(input()) for _ in range(n)]
    card = [[0]*3]*3
    for i in range(n):
        for j in range(n):
            card[i][j]  == False
            for k in range(n):
                if a[i][j] == b[k]:
                    card[i][j] = True
    ans = "No"
    for i in range(3): #横に見てる
        if card[i][0] and card[i][1] and card[i][2]:
            ans = "Yes"
    for i in range(3): # 縦に見てる
        if card[0][i] and card[1][i] and card[2][i]:
            ans = "Yes"
    if card[0][0] and card[1][1] and card[2][2]:
        ans = "Yes"
    if card[0][2] and card[1][1] and card[2][0]:
        ans = "Yes"
    print(ans)

    
if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

A = [0,2,3,4,5,6,7,8,9]
N = int(input())
d = list(int(input()) for i in range(N))

a1.extend(a2)
a1.extend(a3)

for i in range(N):
    if str(a1[i]) in str(d[i]):
        A[i] = 1

if A[0] == A[1] == A[2] or A[3] == A[4] == A[5] or A[6] == A[7] == A[8] or A[2] == A[4] == A[6] or A[0] == A[4]== A[8z]:
    print("yes")
elif A[0] == A[3] == A[6] or A[1] == A[4] == A[7] or A[2] == A[5] == A[8]:
    print("yes")
else:
    print("no")

Submission status: Runtime Error

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

A = [0,2,3,4,5,6,7,8,9]
N = int(input())
d = list(int(input()) for i in range(N))

a1.extend(a2)
a1.extend(a3)

for i in range(N):
    if str(a1[i]) in str(d[i]):
        A[i] = 1

if A[0] == A[1] == A[2] or A[3] == A[4] == A[5] or A[6] == A[7] == A[8] or A[2] == A[4] == A[6]:
    print("yes")
    exit()
elif A[0] == A[3] == A[6] or A[1] == A[4] == A[7] or A[2] == A[5] == A[8]:
    print("yes")
    exit()
else:
    print("no")

Submission status: Runtime Error

Solution code:
=[list(map(int,input().split())) for i in range(3)]
n=int(input())
for k in range(n):
  s=int(input())
  for i in range(3):
    for j in range(3):
      if s == A[i][j]:
        A[i][j]=0   
if A[0][0]==0 and A[1][0]==0 and A[2][0]==0:
  print("Yes")
   
elif A[0][1]==0 and A[1][1]==0 and A[2][1]==0:
  print("Yes")
elif A[0][2]==0 and A[1][2]==0 and A[2][2]==0:
  print("Yes")
elif [0,0,0] in A:
  print("Yes")
  
elif A[0][2]==0 and A[1][1]==0 and A[2][0]==0:
  print("Yes")
  
elif A[0][0]==0 and A[1][1]==0 and A[2][2]==0:
  print("Yes")
  
else:
  print("No")

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split())
b = list(map(int, input().split())
c = list(map(int, input().split())
A = [0,0,0,0,0,0,0,0,0]
N = int(input())
d = list(int(input()) for i in range(N))

a.extend(b)
a.extend(c)

for i in range(N):
    if a[i] in d[i]:
        A[i] = 1

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

Submission status: Runtime Error

Solution code:
for i in range(3):
    a = []
    for j in range(3):
      	a = input().split()
    A.append([int(x) for x in a])
N = int(input())
C = []
for _ in range(3):
    C.append(np.zeros(3))
 
for _ in range(N):
    b = int(input())
    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 sum(C[:][i]) == 3:
        print('Yes')
        exit()
    elif sum(C[i][:]) == 3:
        print('Yes')
        exit()
if C[1][1]+C[2][2]+C[0][0] == 3:
    print('Yes')
elif C[0][2]+C[1][1]+C[2][0] == 3:
    print('Yes')
else: print('No')

Submission status: Runtime Error

Solution code:
for i in range(3):
    a = []
    for j in range(3):
        a.append(input().split())
    A.append(a)
N = int(input())
C = []
for _ in range(3):
    C.append(np.zeros(3))
 
for _ in range(N):
    b = int(input())
    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 sum(C[:][i]) == 3:
        print('Yes')
        break
    elif sum(C[i][:]) == 3:
        print('Yes')
        break
if C[1][1]+C[2][2]+C[0][0] == 3:
    print('Yes')
elif C[0][2]+C[1][1]+C[2][0] == 3:
    print('Yes')
else: print('No')

Submission status: Runtime Error

Solution code:
li_a = list(map(int,input().split()))
li_b = list(map(int,input().split()))
li_c = list(map(int,input().split()))
n = int(input())
li_num=[int(input()) for i in range(n)]
 
li_card = [li_a, li_b, li_c]
 
ans = False
 
#print(li_card)
#print(li_b)
#print(li_c)
#print(n)
#print(li_num)
 
for m in li_num:
    for i in range(3):
        for j in range(3):
          if li_card[i][j] == m:
              li_card[i][j] = 0
 
for i in range(3):
    if li_card[i][0] == li_card[i][1] == li_card[i][2] == 0:
        ans = True
        break
    elif li_card[0][i] == li_card[1][i] == li_card[2][i] == 0:
        ans = True
        break
 
if not ans:
  if li_card[0][0] == li_card[1][1] == li_card[2][2] == 0:
      ans = True
  elif li_card[0][2] == li_card[1][1] == licard[2][0] == 0:
      ans = True
 
if ans:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split())
a += list(map(int, input().split())
a += list(map(int, input().split())
A = [0,0,0,0,0,0,0,0,0]
N = int(input())
b = list(int(input()) for i in range(N))

for i in range(N):
    if a[i] in b[i]:
        A[i] = 1

if A[0] == A[1] == A[2] or A[3] == A[4] == A[5] or A[6] == A[7] == A[8] or A[2] == A[4] == A[6]:
    print("yes")
    exit()
elif A[0] == A[3] == A[6] or A[1] == A[4] == A[7] or A[2] == A[5] == A[8]:
    print("yes")
    exit()
else:
    print("no")

Submission status: Runtime Error

Solution code:
A = []
out = []
for x in range(3):
    A.append(list(map(int, input().split())))
    out.append([0, 0, 0])
N = int(input())
b = []
for B in range(N):
    b.append(int(input()))
for pick in b:
    for y in range(3):
        for x in range(3):
            if pick == A[y][x]:
                out[y][x] = 1

bingo = False
for x in range(3):
    if out[x][0] == 1 and out[x][1]　== 1 and out[x][2] == 1:
        bingo = True

for x in range(3):
    if out[0][x] == 1 and out[1][x] == 1 and out[2][x] == 1:
        bingo = True

for x in range(3):
    if out[0][0] == 1 and out[1][1] == 1 and out[2][2] == 1:
        bingo = True

    if out[2][0] == 1 and out[1][1] == 1 and out[2][0] == 1:
        bingo = True

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

Submission status: Runtime Error

Solution code:
for i in range(3):
    a = []
    for j in range(3):
        a.append(int(input()))
    A.append(a)
N = int(input())
C = []
for _ in range(3):
    C.append(np.zeros(3))
 
for _ in range(N):
    b = int(input())
    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 sum(C[:][i]) == 3:
        print('Yes')
        break
    elif sum(C[i][:]) == 3:
        print('Yes')
        break
if C[1][1]+C[2][2]+C[0][0] == 3:
    print('Yes')
elif C[0][2]+C[1][1]+C[2][0] == 3:
    print('Yes')
else: print('No')

Submission status: Runtime Error

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

for i in range(9):
    if a[i] in b[i]:
        A[i] = "maru"

if A[0] == A[1] == A[2] or A[3] == A[4] == A[5] or A[6] == A[7] == A[8] or A[2] == A[4] == A[6]:
    print("yes")
elif A[0] == A[3] == A[6] or A[1] == A[4] == A[7] or A[2] == A[5] == A[8]:
    print("yes")
else:
    print("no")

Submission status: Runtime Error

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

for i in range(9):
    if a[i] in b[i]:
        A[i] = "maru"
if A[0] == A[1] == A[2] or A[3] == A[4] == A[5] or A[6] == A[7] == A[8] or A[2] == A[4] == A[6]:
    print("yes")
elif A[0] == A[3] == A[6] or A[1] == A[4] == A[7] or A[2] == A[5] == A[8]:
    print("yes")
else:
    print("no")

Submission status: Runtime Error

Solution code:
for i in range(3):
    a = []
    for j in range(3):
        a.append(int(input()))
    A.append(a)
N = int(input())
C = []
for _ in range(3):
    C.append(np.zeros(3))
 
for _ in range(N):
    b = int(input())
    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 sum(C[:][i]) == 3:
        print('Yes')
        exit()
    elif sum(C[i][:]) == 3:
        print('Yes')
        exit()
if C[1][1]+C[2][2]+C[0][0] == 3:
    print('Yes')
elif C[0][2]+C[1][1]+C[2][0] == 3:
    print('Yes')
else: print('No')

Submission status: Runtime Error

Solution code:
A11,A12,A13,A21,A22,A23,A31,A32,A33 = map(int,input().split(" "))
N = int(input())
B = []
for i in range(N):
    b = int(input())
    B.append(b)
bingo = [A11,A12,A13,A21,A22,A23,A31,A32,A33]
bingo = ",".join(map(str,bingo))
for i in B:
    i = str(i)
    if i in bingo:
        bingo = bingo.replace(i,"True")
    else:
        pass
    
Bingo = bingo.split(",")
Flag = False
if Bingo[0] == Bingo[1] == Bingo[2]=="True":
    Flag = True
if Bingo[3] == Bingo[4] == Bingo[6]=="True":
    Flag = True
if Bingo[6] == Bingo[7] == Bingo[8]=="True":
    Flag = True
if Bingo[0] == Bingo[3] == Bingo[6]=="True":
    Flag = True
if Bingo[1] == Bingo[4] == Bingo[7]=="True":
    Flag = True
if Bingo[2] == Bingo[5] == Bingo[8]=="True":
    Flag = True
if Bingo[0] == Bingo[4] == Bingo[8]=="True":
    Flag = True
if Bingo[2] == Bingo[4] == Bingo[6]=="True":
    Flag = True
else:
    pass
if Flag == True:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
flag = 0
for i  in a:
    if i in A:
        A[A.index(i)] = "0"
B = []
C = []
D = []
E = []
F = []
for i in range(3):
    B.append(A[4*i])
    C.append(A[2*(i+1)])
    D.append(A[3*i])
    E.append(A[3*i+1])
    F.append(A[3*i+2])
    if "0" in A[i*3:i*3+3]:
        if A[i*3:i*3+3].count("0") == 3:
            flag = 1
if "0" in B:
    if B.count("0") == 3:
        flag = 1
if"0"in C:
    if C.count("0") == 3:
        flag = 1
if"0"in D:
    if D.count("0") == 3:
        flag = 1
if"0"in E:
    if E.count("0") == 3:
        flag = 1
if"0"in F:
    if F.count("0") == 3:
        flag = 1
if flag == 1:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
A11,A12,A13,A21,A22,A23,A31,A32,A33 = map(int,input().split(" "))
bingo = [A11,A12,A13,A21,A22,A23,A31,A32,A33]
bingo = ",".join(map(str,bingo))
N = int(input())
for i in range(N):
    b = input()
    if b in bingo:
        bingo.replace(b,True)
    else:
        pass
Bingo = bingo.split(",")
Flag = False
if Bingo[0] == Bingo[1] == Bingo[2]==True:
    Flag = True
if Bingo[3] == Bingo[4] == Bingo[6]==True:
    Flag = True
if Bingo[6] == Bingo[7] == Bingo[8]==True:
    Flag = True
if Bingo[0] == Bingo[3] == Bingo[6]==True:
    Flag = True
if Bingo[1] == Bingo[4] == Bingo[7]==True:
    Flag = True
if Bingo[2] == Bingo[5] == Bingo[8]==True:
    Flag = True
if Bingo[0] == Bingo[4] == Bingo[8]==True:
    Flag = True
if Bingo[2] == Bingo[4] == Bingo[6]==True:
    Flag = True
else:
    pass
if flag == True:
    print("Yes")
else:
    print("No")