Problem: 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.

Submission attempts (in order):
#157b
a=[[int(i) for i in input().split()] for _ in range(3)]

n=int(input())
b=[[int(i) for i in input().split()] for _ in range(n)]
for i in range(3):
	for j in range(3):
		for e in b:
			if a[i][j]==e:
				a[i][j]=0
ans='No'
for i in range(3):
	if a[i][0]==a[i][1]==[i][2]:
		ans='Yes'
	elif a[0][i]==a[1][i]==a[2][i]:
		ans='Yes'
	elif a[0][0]==a[1][1]==a[2][2]:
		ans='Yes'
	elif a[0][2]==a[1][1]==a[2][0]:
		ans='Yes'
print(ans)

#157b
a=[[int(i) for i in input().split()] for _ in range(3)]
n=int(input())
for i in range(n):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k]==b:
               a[j][k]=0
print("a", a)
ans='No'
for i in range(3):
    if a[i][0]==a[i][1]==a[i][2]:
        ans='Yes'
    elif a[0][i]==a[1][i]==a[2][i]:
        ans='Yes'
    elif a[0][0]==a[1][1]==a[2][2]:
        ans='Yes'
    elif a[0][2]==a[1][1]==a[2][0]:
        ans='Yes'
print(ans)


#157b
a=[[int(i) for i in input().split()] for _ in range(3)]
# print("a",a)
# print(a[0][0])
n=int(input())
#print("b:",b)
for i in range(n):
    b=int(input())
	for j in range(3):
		for k in range(3):
			#print("e",e)
			if a[j][k]==e:
				a[j][k]=0
				#print("a:",a)
ans='No'
for i in range(3):
	if a[i][0]==a[i][1]==[i][2]:
		ans='Yes'
	elif a[0][i]==a[1][i]==a[2][i]:
		ans='Yes'
	elif a[0][0]==a[1][1]==a[2][2]:
		ans='Yes'
	elif a[0][2]==a[1][1]==a[2][0]:
		ans='Yes'
print(ans)

#157b
a=[[int(i) for i in input().split()] for _ in range(3)]

n=int(input())
b=[[int(i) for i in input().split()] for _ in range(n)]
for i in range(3):
	for j in range(3):
		for e in b:
			if a[i][j]==e:
				a[i][j]=0
ans='No'
for i in range(3):
	if a[i][0]==a[i][1]==[i][2]:
		ans='Yes'
	elif a[0][i]==a[1][i]==a[2][i]:
		ans='Yes'
	elif a[0][0]==a[1][1]==a[2][2]:
		ans='Yes'
	elif a[0][2]==a[1][1]==a[2][0]:
		ans='Yes'
print(ans)

#157b
a=[[int(i) for i in input().split()] for _ in range(3)]
# print("a",a)
# print(a[0][0])
n=int(input())
#print("b:",b)
for i in range(n):
    b=int(input())
	for j in range(3):
		for k in range(3):
			#print("e",e)
			if a[j][k]==b:
				a[j][k]=0
				#print("a:",a)
ans='No'
for i in range(3):
	if a[i][0]==a[i][1]==[i][2]:
		ans='Yes'
	elif a[0][i]==a[1][i]==a[2][i]:
		ans='Yes'
	elif a[0][0]==a[1][1]==a[2][2]:
		ans='Yes'
	elif a[0][2]==a[1][1]==a[2][0]:
		ans='Yes'
print(ans)


#157b
a=[[int(i) for i in input().split()] for _ in range(3)]

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

#157b
a=[[int(i) for i in input().split()] for _ in range(3)]
# print("a",a)
# print(a[0][0])
n=int(input())
#print("b:",b)
for i in range(n):
    b=int(input())
	for j in range(3):
		for k in range(3):
			#print("e",e)
			if a[j][k]==b:
				a[j][k]=0
				#print("a:",a)
ans='No'
for i in range(3):
	if a[i][0]==a[i][1]==[i][2]:
		ans='Yes'
	elif a[0][i]==a[1][i]==a[2][i]:
		ans='Yes'
	elif a[0][0]==a[1][1]==a[2][2]:
		ans='Yes'
	elif a[0][2]==a[1][1]==a[2][0]:
		ans='Yes'
print(ans)


#157b
a=[[int(i) for i in input().split()] for _ in range(3)]
n=int(input())

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

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


#157b
a=[[int(i) for i in input().split()] for _ in range(3)]
n=int(input())
for i in range(n):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k]==b:
               a[j][k]=0
ans='No'
for i in range(3):
    if a[i][0]==a[i][1]==a[i][2]:
        ans='Yes'
    elif a[0][i]==a[1][i]==a[2][i]:
        ans='Yes'
    elif a[0][0]==a[1][1]==a[2][2]:
        ans='Yes'
    elif a[0][2]==a[1][1]==a[2][0]:
        ans='Yes'
print(ans)


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Accepted