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):
from collections import Counter
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
A=[A1,A2,A3]
N=int(input())
for _ in range(N):
  b=int(input())
  
  for tmpA in A:
    if b in tmpA:
      index=tmpA.index(b)
      tmpA[index]=-1
      break
  

  

if True in [ not False in [A[j][i]==A[j+1][i] for j in range(len(A)-1)] for i in range(len(A[0]))]:
  print("Yes")

elif True in [len(Counter(tmpA))==1 for tmpA in A]:
  print("Yes")

elif [A[i][i] == A[i+1][i+1]for i in range(len(A)-1)] or [A[len(A)-(i+1)][i] == A[len(A)-(i+2)][i+1]for i in range(len(A)-1)]
  print("Yes")

else:
  print("No")


from collections import Counter
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
A=[A1,A2,A3]
N=int(input())
for _ in range(N):
  b=int(input())
  
  for tmpA in A:
    if b in tmpA:
      index=tmpA.index(b)
      tmpA[index]=-1
      break
  

  

if True in [[tmpA[i]==tmpA[i] and [i]==[i] for i in range(3)] for tmpA in A]
  print("Yes")

elif len(Counter(A[0]))==1 or len(Counter(A[1]))==1 or len(Counter(A[2]))==1:
  print("Yes")

elif A[1][1]==-1 and (A[0][0] == A[2][2] or A[0][2]==A[2][0]):
  print("Yes")

else:
  print("No")


from collections import Counter
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
A=[A1,A2,A3]
N=int(input())
for _ in range(N):
  b=int(input())
  
  for tmpA in A:
    if b in tmpA:
      index=tmpA.index(b)
      tmpA[index]=-1
      break
  


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

 

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

from collections import Counter
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
A=[A1,A2,A3]
N=int(input())
for _ in range(N):
  b=int(input())
  
  for tmpA in A:
    if b in tmpA:
      index=tmpA.index(b)
      tmpA[index]=-1
      break
  

  

if True in [ not False in [A[j][i]==A[j+1][i] for j in range(len(A)-1)] for i in range(len(A[0]))]:
  print("Yes")

elif True in [len(Counter(tmpA))==1 for tmpA in A]:
  print("Yes")

elif not False in [A[i][i] == A[i+1][i+1]for i in range(len(A)-1)] or not False in  [A[len(A)-(i+1)][i] == A[len(A)-(i+2)][i+1]for i in range(len(A)-1)]
  print("Yes")

else:
  print("No")

from collections import Counter
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
A=[A1,A2,A3]
N=int(input())
for _ in range(N):
  b=int(input())
  
  for tmpA in A:
    if b in tmpA:
      index=tmpA.index(b)
      tmpA[index]=-1
      break
  

  

if True in [ not False in [A[j][i]==A[j+1][i] for j in range(len(A)-1)] for i in range(len(A[0]))]:
  print("Yes")

elif True in [len(Counter(tmpA))==1 for tmpA in A]:
  print("Yes")

elif A[1][1]==-1 and (A[0][0] == A[2][2] or A[0][2]==A[2][0]):
  print("Yes")

else:
  print("No")


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Accepted