qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

a = LIR(3)
n = I()
b = IR(n)


def check(A, B):
   S = set(b)
 
   # check each row
   for r in xrange(3):
      cnt = 0
      for c in xrange(3):
         if A[r][c] in S:
            cnt += 1
      if cnt == 3:
         return True
 
   # check each colum
   for c in xrange(3):
      cnt = 0
      for r in xrange(3):
         if A[r][c] in S:
            cnt += 1
      if cnt == 3:
         return True
 
   # check back diagonal
   cnt = 0
   for i in xrange(3):
      if A[i][i] in S:
         cnt += 1
   if cnt == 3:
      return True
 
   # check forward diagonal
   cnt = 0
   for i in xrange(3):
      if A[i][2-i] in S:
         cnt += 1
   if cnt == 3:
      return True
 
   return False
 
 
print 'Yes' if check(A, B) else 'No'

return 

Fixed code:
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

a = LIR(3)
n = I()
b = IR(n)


def check(A, B):
   S = set(b)
 
   # check each row
   for r in range(3):
      cnt = 0
      for c in range(3):
         if A[r][c] in S:
            cnt += 1
      if cnt == 3:
         return True
 
   # check each colum
   for c in range(3):
      cnt = 0
      for r in range(3):
         if A[r][c] in S:
            cnt += 1
      if cnt == 3:
         return True
 
   # check back diagonal
   cnt = 0
   for i in range(3):
      if A[i][i] in S:
         cnt += 1
   if cnt == 3:
      return True
 
   # check forward diagonal
   cnt = 0
   for i in range(3):
      if A[i][2-i] in S:
         cnt += 1
   if cnt == 3:
      return True
 
   return False
 
 
print('Yes' if check(a, b) else 'No')
Buggy code:
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())

val = 0
flag = False

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

val = A[0][2] + A[1][1] + A[2][0]
if val == 0:
    flag = True

for i in range(3):
    if sum(A[i]) == 0:
        flag = True
    
    val = 0
    for j in range(3):
        val += A[j][i]
    if val == 0:
        flag = True

if flag == True:
    print('Yes')
else:
    print('No')

Fixed code:
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())

val = 0
flag = False

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

val = 0
for i in range(3):
    val += A[i][i]
if val == 0:
    flag = True

val = A[0][2] + A[1][1] + A[2][0]
if val == 0:
    flag = True

for i in range(3):
    if sum(A[i]) == 0:
        flag = True
    
    val = 0
    for j in range(3):
        val += A[j][i]
    if val == 0:
        flag = True

if flag == True:
    print('Yes')
else:
    print('No')
Buggy code:
import numpy as np

def isBingo(isOpen):
    if np.any(np.all(isOpen==1,axis=0)==True) or \
        np.any(np.all(isOpen==1,axis=1)==True):
        return "Yes"
    cnt1=0
    cnt2=0
    for i in range(3):
        if isOpen[i][i]==1:
            cnt1+=1
        if isOpen[i][2-i]==1:
            cnt1+=1
    if cnt1==3 or cnt2==3:
        return "Yes"
    else:
        return "No"

bingo = [list(map(int, input().split())) for _ in range(3)]
n = int(input().strip())

isOpen=np.zeros([3,3])
for _ in range(n):
    b=int(input().strip())
    for i in range(3):
        for j in range(3):
            if b==bingo[i][j]:
                isOpen[i][j]=1
print(isBingo(isOpen))

Fixed code:
import numpy as np

def isBingo(isOpen):
    if np.any(np.all(isOpen==1,axis=0)==True) or \
        np.any(np.all(isOpen==1,axis=1)==True):
        return "Yes"
    cnt1=0
    cnt2=0
    for i in range(3):
        if isOpen[i][i]==1:
            cnt1+=1
        if isOpen[i][2-i]==1:
            cnt2+=1
    if cnt1==3 or cnt2==3:
        return "Yes"
    else:
        return "No"

bingo = [list(map(int, input().split())) for _ in range(3)]
n = int(input().strip())

isOpen=np.zeros([3,3],dtype=int)
for _ in range(n):
    b=int(input().strip())
    for i in range(3):
        for j in range(3):
            if b==bingo[i][j]:
                isOpen[i][j]=1
print(isBingo(isOpen))
Buggy code:
A = list(map(str, input().split()))
A += list(map(str, input().split()))
A += list(map(str, input().split()))
a = []
N = int(input())
for i in range(7):
    a.append(input())
flag = 0
for i  in a:
    if i in A:
        A[A.index(i)] = "0"
B = []
C = []
for i in range(3):
    B.append(A[4*i])
    C.append(A[2*i])
    if "0" in A[i*3:i*3+3]:
        if A.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 flag == 1:
    print("Yes")
else:
    print("No")

Fixed code:
A = list(map(str, input().split()))
A += list(map(str, input().split()))
A += list(map(str, input().split()))
a = []
N = int(input())
for i in range(N):
    a.append(input())
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")
Buggy code:

A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
N=int(input())
b=[0]*N
for i in range(N):
  print(i)
  b[i]=int(input())
C1=any([i == A1[0] for i in b])
C2=any([i == A1[1] for i in b])
C3=any([i == A1[2] for i in b])
C4=any([i == A2[0] for i in b])
C5=any([i == A2[1] for i in b])
C6=any([i == A2[2] for i in b])
C7=any([i == A3[0] for i in b])
C8=any([i == A3[1] for i in b])
C9=any([i == A3[2] for i in b])

if(any(all(C1,C2,C3),all(C4,C5,C6),all(C7,C8,C9),all(C1,C4,C7),all(C2,C5,C8),all(C3,C6,C9),all(C1,C5,C9),all(C3,C5,C7)):
   print("Yes")
else:
   print("No")

Fixed code:
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
N=int(input())
b=[0]*N
for i in range(N):
  b[i]=int(input())
C1=any([i == A1[0] for i in b])
C2=any([i == A1[1] for i in b])
C3=any([i == A1[2] for i in b])
C4=any([i == A2[0] for i in b])
C5=any([i == A2[1] for i in b])
C6=any([i == A2[2] for i in b])
C7=any([i == A3[0] for i in b])
C8=any([i == A3[1] for i in b])
C9=any([i == A3[2] for i in b])

if(any([all([C1,C2,C3]),all([C4,C5,C6]),all([C7,C8,C9]),all([C1,C4,C7]),all([C2,C5,C8]),all([C3,C6,C9]),all([C1,C5,C9]),all([C3,C5,C7])])):
   print("Yes")
else:
   print("No")
Buggy code:
from functools import reduce

a = reduce(lambda a, b: a + b, [list(map(int, input().split())) for _ in range(3)])
print(a)
n = int(input())
b = {int(input()): None for _ in range(n)}

r = [(ai in b) for ai in a]

combs = [
    [0,1,2],
    [3,4,5],
    [6,7,8],
    [0,3,6],
    [1,4,7],
    [2,5,8],
    [0,4,8],
    [2,4,6],
]
if any([all([r[c] for c in comb]) for comb in combs]):
    print('Yes')
else:
    print('No')

Fixed code:
a = []
for _ in range(3):
    a += list(map(int, input().split()))
n = int(input())
b = {int(input()): None for _ in range(n)}

r = [(ai in b) for ai in a]

combs = [
    [0,1,2],
    [3,4,5],
    [6,7,8],
    [0,3,6],
    [1,4,7],
    [2,5,8],
    [0,4,8],
    [2,4,6],
]
if any([all([r[c] for c in comb]) for comb in combs]):
    print('Yes')
else:
    print('No')
Buggy code:
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    bingo = [True]*9
    dic = dict()
    c = 0
    for _ in range(3):
        tmp = list(IL())
        for rep in tmp:
            dic[rep] = c
            c += 1
    n = I()
    for _ in range(n):
        b = I()
        idx = dic.get(b)
        if idx is None:
            continue
        bingo[idx] = True
    

    print(bingo)
    
    flag = False
    for i in range(0,3):
        for j in range(0,7,3):
            if not bingo[i+j]:
                break
        else:
            flag = True
    if flag:
        print('Yes')
        return
        
    for i in range(0,7,3):
        for j in range(0,3):
            if not bingo[i+j]:
                break
        else:
            flag = True
    if flag:
        print('Yes')
        return

    if (bingo[2] and bingo[4] and bingo[6]) or (bingo[0] and bingo[4] and bingo[8]):
        print('Yes')
    else:
        print('No')
    return

if __name__=='__main__':
    solve()

Fixed code:
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    bingo = [False]*9
    dic = dict()
    c = 0
    for _ in range(3):
        tmp = list(IL())
        for rep in tmp:
            dic[rep] = c
            c += 1
    n = I()
    for _ in range(n):
        b = I()
        idx = dic.get(b)
        if idx is None:
            continue
        bingo[idx] = True
    
    flag = False
    for i in range(0,3):
        for j in range(0,7,3):
            if not bingo[i+j]:
                break
        else:
            flag = True
    if flag:
        print('Yes')
        return
        
    for i in range(0,7,3):
        for j in range(0,3):
            if not bingo[i+j]:
                break
        else:
            flag = True
    if flag:
        print('Yes')
        return

    if (bingo[2] and bingo[4] and bingo[6]) or (bingo[0] and bingo[4] and bingo[8]):
        print('Yes')
    else:
        print('No')
    return

if __name__=='__main__':
    solve()
Buggy code:
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
n=int(input())
ans=[[0,0,0] for i in range(3)]
for i in range(n):
  s=int(input())
  for T in [A,B,C]:
    if s in T:
      ans[T.index(s)]=1
for i in range(3):
  if ans[i]==[1,1,1]:
    print("Yes")
    exit()
for i in range(3):
  if [ans[i][j] for j in range(3)]==[1,1,1]:
    print("Yes")
    exit()
if [ans[0][0],ans[1][1],ans[2][2]]==[1,1,1]:
  print("Yes")
  exit()
if [ans[0][2],ans[1][1],ans[2][0]]==[1,1,1]:
  print("Yes")
  exit()
print("No")

Fixed code:
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
n=int(input())
ans=[[0,0,0] for i in range(3)]

for i in range(n):
  s=int(input())
  count=-1
  for T in [A,B,C]:
    count+=1
    if s in T:
      
      ans[count][T.index(s)]=1
for i in range(3):
  if ans[i]==[1,1,1]:
    print("Yes")
    exit()
for i in range(3):
  if [ans[j][i] for j in range(3)]==[1,1,1]:
    print("Yes")
    exit()
if [ans[0][0],ans[1][1],ans[2][2]]==[1,1,1]:
  print("Yes")
  exit()
if [ans[0][2],ans[1][1],ans[2][0]]==[1,1,1]:
  print("Yes")
  exit()
print("No")
Buggy code:
import numpy as np
A = [list(map(int, input().split())) for i in range(0,3)]
N = int(input())
b_list =list([int(input()) for i in range(0,N)])
count = np.zeros(3,3)
for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b_list:
            count[i][j] = count + (i+1)*(j+1)
if (count.sum(axis=1) % 3 ==0).any():
    print('Yes')
elif (count.sum(axis=0) % 3 ==0).any():
    print('Yes')
elif count[0][0] + count[1][1] + count[2][2]:
    print('Yes')
elif count[2][0] + count[1][1] + count[0][2]:
    print('Yes')
else:
    print('No')

Fixed code:
import numpy as np
A = [list(map(int, input().split())) for i in range(0,3)]
N = int(input())
b_list =list([int(input()) for i in range(0,N)])
count = np.zeros((3,3))
for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b_list:
            count[i][j] = count[i][j] + 1
if (count.sum(axis=1)  ==3).any():
    print('Yes')
elif (count.sum(axis=0) ==3).any():
    print('Yes')
elif count[0][0] + count[1][1] + count[2][2]==3:
    print('Yes')
elif count[2][0] + count[1][1] + count[0][2]==3:
    print('Yes')
else:
    print('No')
Buggy code:
if __name__ == '__main__':
    m = [input() for _ in range(3)]
    n = input()
    a = [int(input()) for _ in range(int(n))]
    c =[]
    for i in m:
        b = [int(j) for j in i.split()]
        c.append(b)

    for n,i in enumerate(c):
        for m,j in enumerate(i):
            if j in a:
                print("A")
                c[n][m] = -1
                
    re = []
    for i in range(3):
        tmp = []
        tmp2 = []
        for j in range(3):
            tmp.append([i,j])
            tmp2.append([j,i])
        re.append(tmp)
        re.append(tmp2)
    re.append([[0,2],[1,1],[2,0]])
    re.append([[0,0],[1,1],[2,2]])

    f = 0
    for i in re:
        flg =[]
        for n,j in enumerate(i):
            if c[j[0]][j[1]] == -1:
                flg.append(1)
            else:
                flg.append(0)
        if flg == [1,1,1]:
            f = 1
    
    if f == 1:
        print('Yes')
    else:
        print('No')

Fixed code:
if __name__ == '__main__':
    m = [input() for _ in range(3)]
    n = input()
    a = [int(input()) for _ in range(int(n))]
    c =[]
    for i in m:
        b = [int(j) for j in i.split()]
        c.append(b)

    for n,i in enumerate(c):
        for m,j in enumerate(i):
            if j in a:
                c[n][m] = -1
                
    re = []
    for i in range(3):
        tmp = []
        tmp2 = []
        for j in range(3):
            tmp.append([i,j])
            tmp2.append([j,i])
        re.append(tmp)
        re.append(tmp2)
    re.append([[0,2],[1,1],[2,0]])
    re.append([[0,0],[1,1],[2,2]])

    f = 0
    for i in re:
        flg =[]
        for n,j in enumerate(i):
            if c[j[0]][j[1]] == -1:
                flg.append(1)
            else:
                flg.append(0)
        if flg == [1,1,1]:
            f = 1
    
    if f == 1:
        print('Yes')
    else:
        print('No')
Buggy code:
A1 = [0] * 3
A2 = [0] * 3
A3 = [0] * 3
for i in range(3):
    A1[i], A2[i], A3[i] = map(int, input().split())

N = int(input())
b = []
for _ in range(N):
    b.append(int(input()))

for i in b:
    for j in range(3):
        if A1[j] == i:
            A1[j] = 'ok'
        elif A2[j] == i:
            A2[j] = 'ok'
        elif A3[j] == i:
            A3[j] = 'ok'

for j in range(3):
    if j == 0:
        if A1[j] == A1[j+1] == A1[j+2]:
            print('Yes')
            break
        elif A2[j] == A2[j+1] == A2[j+2]:
            print('Yes')
            break
        elif A3[j] == A3[j+1] == A3[j+2]:
            print('Yes')
            break
        elif A1[j] == A2[j+1] == A3[j+2]:
            print('Yes')
            break
        elif A3[j] == A2[j+1] == A1[j+2]:
            print('Yes')
            break
        elif A1[j] == A2[j] == A3[j]:
            print('Yes')
            break
    elif j >= 1:
        if A1[j] == A2[j] == A3[j]:
            print('Yes')
            break
    else:
        print('No')
        break

Fixed code:
A1 = [0] * 3
A2 = [0] * 3
A3 = [0] * 3
for i in range(3):
    A1[i], A2[i], A3[i] = map(int, input().split())

N = int(input())
b = []
for _ in range(N):
    b.append(int(input()))

for i in b:
    for j in range(3):
        if A1[j] == i:
            A1[j] = 'ok'
        elif A2[j] == i:
            A2[j] = 'ok'
        elif A3[j] == i:
            A3[j] = 'ok'


if A1[0] == A1[1] == A1[2]:
    print('Yes')

elif A2[0] == A2[1] == A2[2]:
    print('Yes')

elif A3[0] == A3[1] == A3[2]:
    print('Yes')

elif A1[0] == A2[1] == A3[2]:
    print('Yes')

elif A3[0] == A2[1] == A1[2]:
    print('Yes')

elif A1[0] == A2[0] == A3[0]:
    print('Yes')

elif A1[1] == A2[1] == A3[1]:
    print('Yes')

elif A1[2] == A2[2] == A3[2]:
    print('Yes')
    
else:
    print('No')
Buggy code:
# -*- coding: utf-8 -*-
# @Time    : 2020/3/1 19:59
# @Author  : DIRICHLET
# @File    : main.py


b=[[0,0,0]]*3
#print(b)
m={}
for i in range(3):
    t=list(map(int,input().split()))
    k=0
    for j in t:
        m[j]=(i,k)
        k+=1
n=int(input())
for i in n:
    t=int(input())
    if t in m:
        #print(m[t])
        b[m[t][0]][m[t][1]]=1
for i in b:
    ans=1
    for j in i:
        ans*=j
    if ans==1:
        print('Yes')
        exit()
for i in range(3):
    ans=1
    for j in range(3):
        ans*=b[j][i]
    if ans==1:
        print('Yes')
        exit()
if b[0][0]*b[1][1]*b[2][2]==1:
    print('Yes')
    exit()
if b[0][2]*b[1][1]*b[2][0]==1:
    print('Yes')
    exit()
print('No')

Fixed code:
# -*- coding: utf-8 -*-
# @Time    : 2020/3/1 19:59
# @Author  : DIRICHLET
# @File    : main.py


b=[[0,0,0],[0,0,0],[0,0,0]]
#print(b)
m={}
for i in range(3):
    t=list(map(int,input().split()))
    k=0
    for j in t:
        m[j]=(i,k)
        k+=1
n=int(input())
for i in range(n):
    t=int(input())
    if t in m:
        #print(m[t])
        b[m[t][0]][m[t][1]]=1
for i in b:
    ans=1
    for j in i:
        ans*=j
    if ans==1:
        print('Yes')
        exit()
for i in range(3):
    ans=1
    for j in range(3):
        ans*=b[j][i]
    if ans==1:
        print('Yes')
        exit()
if b[0][0]*b[1][1]*b[2][2]==1:
    print('Yes')
    exit()
if b[0][2]*b[1][1]*b[2][0]==1:
    print('Yes')
    exit()
print('No')
Buggy code:
A = []
for i in range(0, 3):
  a = input().split(' ')
  for j in a:
    A.append(int(j))

# print(A)
N = int(input())

for i in range(0, N):
  data = int(input())
  if data in A:
    A[A.index(data)] = 0

# horizonal
if sum(A[0:3]) == 0 \
or sum(A[3:6]) == 0 \
or sum(A[6:9]) == 0 \
# diagonal
or A[0] + A[4] + A[8] == 0 \
or A[2] + A[4] + A[6] == 0 \
# Virtical
or A[0] + A[3] + A[6] == 0 \
or A[1] + A[4] + A[7] == 0 \
or A[2] + A[5] + A[8] == 0: 
  print("Yes")
else:
  print("No")

Fixed code:
A = []
for i in range(0, 3):
  a = input().split(' ')
  for j in a:
    A.append(int(j))

# print(A)
N = int(input())

for i in range(0, N):
  data = int(input())
  if data in A:
    A[A.index(data)] = 0

if sum(A[0:3]) == 0 \
or sum(A[3:6]) == 0 \
or sum(A[6:9]) == 0 \
or A[0] + A[4] + A[8] == 0 \
or A[2] + A[4] + A[6] == 0 \
or A[0] + A[3] + A[6] == 0 \
or A[1] + A[4] + A[7] == 0 \
or A[2] + A[5] + A[8] == 0: 
  print("Yes")
else:
  print("No")
Buggy code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
grid = []
for _ in range(3):
    array = list(map(int, input().strip().split()))
    grid.append(array)

def judge():
    for i in range(3):
        if grid[i][0] == 0 and grid[i][1] == 0 and grid[i][2]:
            return True
    if grid[0][0] == 0 and grid[1][1] == 0 and grid[2][2] == 0:
        return True
    if grid[0][2] == 0 and grid[1][1] == 0 and grid[2][0] == 0:
        return True
    return False

n = int(input())
ans = "No"
for _ in range(n):
    b = int(input())
    for i in range(3):
        if b in grid[i]:
            grid[i][grid[i].index(b)] = 0
    if judge():
        ans = "Yes"
    print (grid)

print (ans)

Fixed code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
grid = []
for _ in range(3):
    array = list(map(int, input().strip().split()))
    grid.append(array)

def judge():
    for i in range(3):
        if grid[i][0] == 0 and grid[i][1] == 0 and grid[i][2] == 0:
            return True
        if grid[0][i] == 0 and grid[1][i] == 0 and grid[2][i] == 0:
            return True
    if grid[0][0] == 0 and grid[1][1] == 0 and grid[2][2] == 0:
        return True
    if grid[0][2] == 0 and grid[1][1] == 0 and grid[2][0] == 0:
        return True
    return False

n = int(input())
ans = "No"
for _ in range(n):
    b = int(input())
    for i in range(3):
        if b in grid[i]:
            grid[i][grid[i].index(b)] = 0
    if judge():
        ans = "Yes"
#    print (grid)

print (ans)
Buggy code:
list1 = list(map(int, input().split()))
list2 = list(map(int, input().split()))
list3 = list(map(int, input().split()))
n = int(input())
num_list = []
for i in range(n):
    b = int(input())
    num_list.append(b)
for num in num_list:
    if num in list1:
        x = list1.index(num)
        list1.pop(x)
        list1.insert(x, 'bingo')
    if num in list2:
        x = list2.index(num)
        list2.pop(x)
        list2.insert(x, 'bingo')
    if num in list3:
        x = list3.index(num)
        list3.pop(x)
        list3.insert(x, 'bingo')
result = 'No'
if list1[0] == list1[1] == list1[2] == 'bingo':
    result = 'Yes'
if list2[0] == list2[1] == list2[2] == 'bingo':
    result = 'Yes'
if list3[0] == list3[1] == list3[2] == 'bingo':
    result = 'Yes'
if list1[0] == list2[0] == list3[0] == 'bingo':
    result = 'Yes'
if list1[1] == list2[1] == list3[1] == 'bingo':
    result = 'Yes'
if list1[2] == list2[2] == list3[2] == 'bingo':
    result = 'Yes'
if list1[0] == list2[1] == list3[2] == 'bingo':
    result = 'Yes'
if list1[2] == list2[1] == list3[0] == 'bingo':
    result = 'Yes'
print(list1)
print(list2)
print(list3)
print(result)

Fixed code:
list1 = list(map(int, input().split()))
list2 = list(map(int, input().split()))
list3 = list(map(int, input().split()))
n = int(input())
num_list = []
for i in range(n):
    b = int(input())
    num_list.append(b)
for num in num_list:
    if num in list1:
        x = list1.index(num)
        list1.pop(x)
        list1.insert(x, 'bingo')
    if num in list2:
        x = list2.index(num)
        list2.pop(x)
        list2.insert(x, 'bingo')
    if num in list3:
        x = list3.index(num)
        list3.pop(x)
        list3.insert(x, 'bingo')
result = 'No'
if list1[0] == list1[1] == list1[2] == 'bingo':
    result = 'Yes'
if list2[0] == list2[1] == list2[2] == 'bingo':
    result = 'Yes'
if list3[0] == list3[1] == list3[2] == 'bingo':
    result = 'Yes'
if list1[0] == list2[0] == list3[0] == 'bingo':
    result = 'Yes'
if list1[1] == list2[1] == list3[1] == 'bingo':
    result = 'Yes'
if list1[2] == list2[2] == list3[2] == 'bingo':
    result = 'Yes'
if list1[0] == list2[1] == list3[2] == 'bingo':
    result = 'Yes'
if list1[2] == list2[1] == list3[0] == 'bingo':
    result = 'Yes'

print(result)