import numpy as np

N_1=list(map(int, input().split()))

N_2=list(map(int, input().split()))

N_3=list(map(int, input().split()))

N=int(eval(input()))

a=[int(eval(input())) for i in range(N)]



n=np.array([N_1,N_2,N_3])



for a_n in a:

    if a_n in n:

        n[n==a_n]=0

    else:

        pass

i=0

    

if np.all(n[0:,0]==0)==True:

    i=+1

    

elif np.all(n[0:,1]==0)==True:

    i+=1

    

elif np.all(n[0:,2]==0)==True:

    i+=1

    

elif np.all(n[0,0:]==0)==True:

    i+=1

    

elif np.all(n[1,0:]==0)==True:

    i+=1



elif np.all(n[2,0:]==0)==True:

    i+=1



elif n[0,0]==0 and n[1,1]==0  and n[2,2] ==0:

    i+=1

    

elif n[0,2]==0 and n[1,1]==0 and n[2,0] ==0:

    i+=1

    

if i>0:

    print("Yes")

else:

    print("No")
a_1=list(map(int, input().split()))

a_2=list(map(int, input().split()))

a_3=list(map(int, input().split()))



c=[a_1,a_2,a_3]



N=int(eval(input()))



b=[int(eval(input())) for _ in range(N)]



for i in range(3):

    for j in range(3):

        if c[i][j] in b:

            c[i][j]=0

            

            

i=0

if c[0][0]==0 and c[0][1]==0 and c[0][2]==0:

    i+=1

if c[1][0]==0 and c[1][1]==0 and c[1][2]==0:

    i+=1

if c[2][0]==0 and c[2][1]==0 and c[2][2]==0:

    i+=1

if c[0][0]==0 and c[1][0]==0 and c[2][0]==0:

    i+=1

if c[0][1]==0 and c[1][1]==0 and c[2][1]==0:

    i+=1

if c[0][2]==0 and c[1][2]==0 and c[2][2]==0:

    i+=1

if c[0][0]==0 and c[1][1]==0 and c[2][2]==0:

    i+=1

if c[0][2]==0 and c[1][1]==0 and c[2][0]==0:

    i+=1

    

if i>0:

    print("Yes")

else:

  print("No")
import numpy as np

N_1 = list(map(int, input().split()))
N_2 = list(map(int, input().split()))
N_3 = list(map(int, input().split()))
N = int(eval(input()))
a = [int(eval(input())) for i in range(N)]
n = np.array([N_1, N_2, N_3])
for a_n in a:
    if a_n in n:
        n[n == a_n] = 0
    else:
        pass
i = 0
if np.all(n[0:, 0] == 0) == True:
    i = +1
elif np.all(n[0:, 1] == 0) == True:
    i += 1
elif np.all(n[0:, 2] == 0) == True:
    i += 1
elif np.all(n[0, 0:] == 0) == True:
    i += 1
elif np.all(n[1, 0:] == 0) == True:
    i += 1
elif np.all(n[2, 0:] == 0) == True:
    i += 1
elif n[0, 0] == 0 and n[1, 1] == 0 and n[2, 2] == 0:
    i += 1
elif n[0, 2] == 0 and n[1, 1] == 0 and n[2, 0] == 0:
    i += 1
if i > 0:
    print("Yes")
else:
    print("No")

a_1 = list(map(int, input().split()))
a_2 = list(map(int, input().split()))
a_3 = list(map(int, input().split()))
c = [a_1, a_2, a_3]
N = int(eval(input()))
b = [int(eval(input())) for _ in range(N)]
for i in range(3):
    for j in range(3):
        if c[i][j] in b:
            c[i][j] = 0
i = 0
if c[0][0] == 0 and c[0][1] == 0 and c[0][2] == 0:
    i += 1
if c[1][0] == 0 and c[1][1] == 0 and c[1][2] == 0:
    i += 1
if c[2][0] == 0 and c[2][1] == 0 and c[2][2] == 0:
    i += 1
if c[0][0] == 0 and c[1][0] == 0 and c[2][0] == 0:
    i += 1
if c[0][1] == 0 and c[1][1] == 0 and c[2][1] == 0:
    i += 1
if c[0][2] == 0 and c[1][2] == 0 and c[2][2] == 0:
    i += 1
if c[0][0] == 0 and c[1][1] == 0 and c[2][2] == 0:
    i += 1
if c[0][2] == 0 and c[1][1] == 0 and c[2][0] == 0:
    i += 1
if i > 0:
    print("Yes")
else:
    print("No")

-import numpy as np - -N_1 = list(map(int, input().split())) -N_2 = list(map(int, input().split())) -N_3 = list(map(int, input().split())) +a_1 = list(map(int, input().split())) +a_2 = list(map(int, input().split())) +a_3 = list(map(int, input().split())) +c = [a_1, a_2, a_3] -a = [int(eval(input())) for i in range(N)] -n = np.array([N_1, N_2, N_3]) -for a_n in a: -    if a_n in n: -        n[n == a_n] = 0 -    else: -        pass +b = [int(eval(input())) for _ in range(N)] +for i in range(3): +    for j in range(3): +        if c[i][j] in b: +            c[i][j] = 0 -if np.all(n[0:, 0] == 0) == True: -    i = +1 -elif np.all(n[0:, 1] == 0) == True: +if c[0][0] == 0 and c[0][1] == 0 and c[0][2] == 0: -elif np.all(n[0:, 2] == 0) == True: +if c[1][0] == 0 and c[1][1] == 0 and c[1][2] == 0: -elif np.all(n[0, 0:] == 0) == True: +if c[2][0] == 0 and c[2][1] == 0 and c[2][2] == 0: -elif np.all(n[1, 0:] == 0) == True: +if c[0][0] == 0 and c[1][0] == 0 and c[2][0] == 0: -elif np.all(n[2, 0:] == 0) == True: +if c[0][1] == 0 and c[1][1] == 0 and c[2][1] == 0: -elif n[0, 0] == 0 and n[1, 1] == 0 and n[2, 2] == 0: +if c[0][2] == 0 and c[1][2] == 0 and c[2][2] == 0: -elif n[0, 2] == 0 and n[1, 1] == 0 and n[2, 0] == 0: +if c[0][0] == 0 and c[1][1] == 0 and c[2][2] == 0: +    i += 1 +if c[0][2] == 0 and c[1][1] == 0 and c[2][0] == 0: