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):
seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = False
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[x] = "O"
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    over = True
  elif seen[3] == seen[6] == "O":
    over = True
  elif seen[4] == seen[8] == "O":
    over = True
elif seen[4] == "O":
  if seen[2] == seen[6] == "O":
    over = True
  elif seen[1] == seen[7] == "O":
    over = True
  elif seen[3] == seen[5] == "O":
    over = True
elif seen[8] == "O":
  if seen[6] == seen[7] == "O":
    over = True
  if seen[2] == seen[5] == "O":
    over = True
if not over:
  print("NO")
else:
  print("YES")

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = "NO"
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[seen.index(num)] = "O"
if seen[0] == "O":
  if seen[1] == "O" and seen[2] == "O":
    over = "YES"
  if seen[3] == "O" and seen[6] == "O":
    over = "YES"
  if seen[4] == "O" and seen[8] == "O":
    over = "YES"
if seen[8] == "O":
  if seen[6] == "O" and seen[7] == "O":
    over = "YES"
  if seen[2] == "O" and seen[5] == "O":
    over = "YES"
if seen[4] == "O":
  if seen[6] == "O" and seen[2] == "O":
    over = "YES"
  if seen[1] == "O" and seen[7] == "O":
    over = "YES"
  if seen[3] == "O" and seen[5] == "O":
    over = "YES"
print(over)

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = "NO"
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[seen.index(num)] = "O"
if seen[0] == "O":
  if seen[1] == "O" and seen[2] == "O":
    over = "YES"
  elif seen[3] == "O" and seen[6] == "O":
    over = "YES"
  elif seen[4] == "O" and seen[8] == "O":
    over = "YES"
if seen[8] == "O":
  if seen[6] == "O" and seen[7] == "O":
    over = "YES"
  if seen[2] == "O" and seen[5] == "O":
    over = "YES"
if seen[4] == "O":
  if seen[2] == "O" and seen[6] == "O":
    over = "YES"
  elif seen[1] == "O" and seen[7] == "O":
    over = "YES"
  elif seen[3] == "O" and seen[5] == "O":
    over = "YES"
print(over)

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = list(map(int,input().split()))
seen[3],seen[4],seen[5] = list(map(int,input().split()))
seen[6],seen[7],seen[8] = list(map(int,input().split()))
over = False
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[x] = "O"
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    over = True
  elif seen[3] == seen[6] == "O":
    over = True
  elif seen[4] == seen[8] == "O":
    over = True
elif seen[4] == "O":
  if seen[2] == seen[6] == "O":
    over = True
  elif seen[1] == seen[7] == "O":
    over = True
  elif seen[3] == seen[5] == "O":
    over = True
elif seen[8] == "O":
  if seen[6] == seen[7] == "O":
    over = True
  if seen[2] == seen[5] == "O":
    over = True
if not over:
  print("NO")
else:
  print("YES")

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = False
N = int(input())
for x in range(N):
  num = int(input())
  print(num)
  if num in seen:
    seen[x] = "O"
print(seen)
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    over = True
  elif seen[3] == seen[6] == "O":
    over = True
  elif seen[4] == seen[8] == "O":
    over = True
elif seen[4] == "O":
  if seen[2] == seen[6] == "O":
    over = True
  elif seen[1] == seen[7] == "O":
    over = True
  elif seen[3] == seen[5] == "O":
    over = True
elif seen[8] == "O":
  if seen[6] == seen[7] == "O":
    over = True
  if seen[2] == seen[5] == "O":
    over = True
if not over:
  print("NO")
else:
  print("YES")

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = "NO"
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[seen.index(num)] = "O"
if seen[0] == "O":
  if seen[1] == "O" and seen[2] == "O":
    over = "YES"
  elif seen[3] == "O" and seen[6] == "O":
    over = "YES"
  elif seen[4] == "O" and seen[8] == "O":
    over = "YES"
if seen[8] == "O":
  if seen[6] == "O" and seen[7] == "O":
    over = "YES"
  if seen[2] == "O" and seen[5] == "O":
    over = "YES"
if seen[4] == "O":
  if seen[2] == "O" and seen[6] == "O":
    over = "YES"
  elif seen[1] == "O" and seen[7] == "O":
    over = "YES"
  elif seen[3] == "O" and seen[5] == "O":
    over = "YES"
print(over)

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = False
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[seen.index(num)] = "O"
if seen[0] == "O":
  if seen[1] == "O" and seen[2] == "O":
    over = True
  elif seen[3] == "O" and seen[6] == "O":
    over = True
  elif seen[4] == "O" and seen[8] == "O":
    over = True
if seen[8] == "O":
  if seen[6] == "O" and seen[7] == "O":
    over = True
  if seen[2] == "O" and seen[5] == "O":
    over = True
if seen[4] == "O":
  if seen[2] == "O" and seen[6] == "O":
    over = True
  elif seen[1] == "O" and seen[7] == "O":
    over = True
  elif seen[3] == "O" and seen[5] == "O":
    over = True
if not over:
  print("NO")
else:
  print("YES")

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = False
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[seen.index(num)] = "O"
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    over = True
  elif seen[3] == seen[6] == "O":
    over = True
  elif seen[4] == seen[8] == "O":
    over = True
if seen[8] == "O":
  if seen[6] == seen[7] == "O":
    over = True
  if seen[2] == seen[5] == "O":
    over = True
if seen[4] == "O":
  if seen[2] == seen[6] == "O":
    over = True
  elif seen[1] == seen[7] == "O":
    over = True
  elif seen[3] == seen[5] == "O":
    over = True
if not over:
  print("NO")
else:
  print("YES")

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = "NO"
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[seen.index(num)] = "O"
if seen[0] == "O":
  if seen[1] == "O" and seen[2] == "O":
    over = "YES"
  elif seen[3] == "O" and seen[6] == "O":
    over = "YES"
  elif seen[4] == "O" and seen[8] == "O":
    over = "YES"
if seen[8] == "O":
  if seen[6] == "O" and seen[7] == "O":
    over = "YES"
  if seen[2] == "O" and seen[5] == "O":
    over = "YES"
if seen[4] == "O":
  if seen[2] == "O" and seen[6] == "O":
    over = "YES"
  elif seen[1] == "O" and seen[7] == "O":
    over = "YES"
  elif seen[3] == "O" and seen[5] == "O":
    over = "YES"
print(over)

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = False
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[seen.index(num)] = "O"
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    over = True
  elif seen[3] == seen[6] == "O":
    over = True
  elif seen[4] == seen[8] == "O":
    over = True
if seen[8] == "O":
  if seen[6] == seen[7] == "O":
    over = True
  if seen[2] == seen[5] == "O":
    over = True
if seen[4] == "O":
  if seen[2] == seen[6] == "O":
    over = True
  elif seen[1] == seen[7] == "O":
    over = True
  elif seen[3] == seen[5] == "O":
    over = True
if not over:
  print("NO")
else:
  print("YES")

nums1 = list(map(int,input().split()))
nums2 = list(map(int,input().split()))
nums3 = list(map(int,input().split()))
seen = [nums1[0],nums1[1],nums1[2],nums2[0],nums2[1],nums2[2],nums3[0],nums3[1],nums3[2]]
over = False
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[x] = "O"
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    print("YES")
    over = True
  elif seen[3] == seen[6] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[8] == "O":
    print("YES")
    over = True
elif seen[2] == "O":
  if seen[5] == seen[8] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[6] == "O":
    print("YES")
    over = True
elif seen[8] == "O" == seen[7] == seen[6]:
  print("YES")
  over = True
elif seen[3] == seen[4] == seen[5] == "O":
  print("YES")
  over = True
elif seen[1] == seen[4] == seen[7] == "O":
  print("YES")
  over = True
else:
  print("NO")
if not over:
  print("YES")

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = False
N = int(input())
for x in range(N):
  num = int(input())
  print(num)
  if num in seen:
    seen[x] = "O"
print(seen)
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    print("YES")
    over = True
  elif seen[3] == seen[6] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[8] == "O":
    print("YES")
    over = True
elif seen[4] == "O":
  if seen[2] == seen[6] == "O":
    print("YES")
    over = True
  elif seen[1] == seen[7] == "O":
    print("YES")
    over = True
  elif seen[3] == seen[5] == "O":
    print("YES")
    over = True
elif seen[8] == "O":
  if seen[6] == seen[7] == "O":
    print("YES")
  if seen[2] == seen[5] == "O":
    print("YES")
  over = True
if not over:
  print("NO")

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = False
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[seen.index(num)] = "O"
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    over = True
  elif seen[3] == seen[6] == "O":
    over = True
  elif seen[4] == seen[8] == "O":
    over = True
elif seen[4] == "O":
  if seen[2] == seen[6] == "O":
    over = True
  elif seen[1] == seen[7] == "O":
    over = True
  elif seen[3] == seen[5] == "O":
    over = True
elif seen[8] == "O":
  if seen[6] == seen[7] == "O":
    over = True
  if seen[2] == seen[5] == "O":
    over = True
if not over:
  print("NO")
else:
  print("YES")

nums1 = list(map(int,input().split()))
nums2 = list(map(int,input().split()))
nums3 = list(map(int,input().split()))
seen = [nums1[0],nums1[1],nums1[2],nums2[0],nums2[1],nums2[2],nums3[0],nums3[1],nums3[2]]
over = False
N = int(input())
for x in range(N):
  num = int(input())
  print(num)
  if num in seen:
    seen[x] = "O"
print(seen)
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    print("YES")
    over = True
  elif seen[3] == seen[6] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[8] == "O":
    print("YES")
    over = True
elif seen[4] == "O":
  if seen[2] == seen[6] == "O":
    print("YES")
    over = True
  elif seen[1] == seen[7] == "O":
    print("YES")
    over = True
  elif seen[3] == seen[5] == "O":
    print("YES")
    over = True
elif seen[8] == "O":
  if seen[6] == seen[7] == "O":
    print("YES")
  if seen[2] == seen[5] == "O":
    print("YES")
  over = True
if not over:
  print("NO")

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = "NO"
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[seen.index(num)] = "O"
if seen[0] == "O":
  if seen[1] == "O" and seen[2] == "O":
    over = "YES"
  elif seen[3] == "O" and seen[6] == "O":
    over = "YES"
  elif seen[4] == "O" and seen[8] == "O":
    over = "YES"
if seen[8] == "O":
  if seen[6] == "O" and seen[7] == "O":
    over = "YES"
  elif seen[2] == "O" and seen[5] == "O":
    over = "YES"
if seen[4] == "O":
  if seen[6] == "O" and seen[2] == "O":
    over = "YES"
  elif seen[1] == "O" and seen[7] == "O":
    over = "YES"
  elif seen[3] == "O" and seen[5] == "O":
    over = "YES"
print(over)

nums1 = list(map(int,input().split()))
nums2 = list(map(int,input().split()))
nums3 = list(map(int,input().split()))
seen = [nums1[0],nums1[1],nums1[2],nums2[0],nums2[1],nums2[2],nums3[0],nums3[1],nums3[2]]
over = False
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[x] = "O"
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    print("YES")
    over = True
  elif seen[3] == seen[6] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[8] == "O":
    print("YES")
    over = True
elif seen[2] == "O":
  if seen[5] == seen[8] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[6] == "O":
    print("YES")
    over = True
elif seen[8] == "O" == seen[7] == seen[6] or seen[3] == seen[4] == seen[5] == "O" or seen[1] == seen[4] == seen[7] == "O":
  print("YES")
  over = True
if not over:
  print("YES")

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = False
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[seen.index(num)] = "O"
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    over = True
  elif seen[3] == seen[6] == "O":
    over = True
  elif seen[4] == seen[8] == "O":
    over = True
elif seen[4] == "O":
  if seen[2] == seen[6] == "O":
    over = True
  elif seen[1] == seen[7] == "O":
    over = True
  elif seen[3] == seen[5] == "O":
    over = True
elif seen[8] == "O":
  if seen[6] == seen[7] == "O":
    over = True
  if seen[2] == seen[5] == "O":
    over = True
if not over:
  print("No")
else:
  print("Yes")

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted