import numpy as np



A = np.zeros((3,3),int)

for i in range(3):

    A[i,:] = np.array([int(x) for x in input().split()])

    

N = int(eval(input()))



for _ in range(N):

    b = int(eval(input()))

    A[A==b] = 0



ans = 'No'

if np.sum(A[0,:])==0 or np.sum(A[1,:])==0 or np.sum(A[2,:])==0 or np.sum(A[:,0])==0 or np.sum(A[:,1])==0 or np.sum(A[:,2])==0 or np.sum(A[0,0]+A[1,1]+A[2,2])==0 or np.sum(A[0,2]+A[1,1]+A[2,0])==0:

   ans = 'Yes'



print(ans)

# B - Bingo



import numpy as np



A = np.zeros((3,3), dtype=np.int64)



for i in range(3):

    A[i] = [int(x) for x in input().split()]



N = int(input())



for _ in range(N):

    b = int(input())

    A = np.where(A==b, 0, A)



if sum(A[0])==0 or sum(A[1])==0 or sum(A[2])==0 or \

    sum(A[:,0])==0 or sum(A[:,1])==0 or sum(A[:,2])==0 or \

    A[0,0]+A[1,1]+A[2,2]==0 or \

    A[2,0]+A[1,1]+A[0,2]==0:

    print('Yes')

else:

    print('No')

import numpy as np

A = np.zeros((3, 3), int)
for i in range(3):
    A[i, :] = np.array([int(x) for x in input().split()])
N = int(eval(input()))
for _ in range(N):
    b = int(eval(input()))
    A[A == b] = 0
ans = "No"
if (
    np.sum(A[0, :]) == 0
    or np.sum(A[1, :]) == 0
    or np.sum(A[2, :]) == 0
    or np.sum(A[:, 0]) == 0
    or np.sum(A[:, 1]) == 0
    or np.sum(A[:, 2]) == 0
    or np.sum(A[0, 0] + A[1, 1] + A[2, 2]) == 0
    or np.sum(A[0, 2] + A[1, 1] + A[2, 0]) == 0
):
    ans = "Yes"
print(ans)

# B - Bingo
import numpy as np

A = np.zeros((3, 3), dtype=np.int64)
for i in range(3):
    A[i] = [int(x) for x in input().split()]
N = int(input())
for _ in range(N):
    b = int(input())
    A = np.where(A == b, 0, A)
if (
    sum(A[0]) == 0
    or sum(A[1]) == 0
    or sum(A[2]) == 0
    or sum(A[:, 0]) == 0
    or sum(A[:, 1]) == 0
    or sum(A[:, 2]) == 0
    or A[0, 0] + A[1, 1] + A[2, 2] == 0
    or A[2, 0] + A[1, 1] + A[0, 2] == 0
):
    print("Yes")
else:
    print("No")

+# B - Bingo -A = np.zeros((3, 3), int) +A = np.zeros((3, 3), dtype=np.int64) -    A[i, :] = np.array([int(x) for x in input().split()]) -N = int(eval(input())) +    A[i] = [int(x) for x in input().split()] +N = int(input()) -    b = int(eval(input())) -    A[A == b] = 0 -ans = "No" +    b = int(input()) +    A = np.where(A == b, 0, A) -    np.sum(A[0, :]) == 0 -    or np.sum(A[1, :]) == 0 -    or np.sum(A[2, :]) == 0 -    or np.sum(A[:, 0]) == 0 -    or np.sum(A[:, 1]) == 0 -    or np.sum(A[:, 2]) == 0 -    or np.sum(A[0, 0] + A[1, 1] + A[2, 2]) == 0 -    or np.sum(A[0, 2] + A[1, 1] + A[2, 0]) == 0 +    sum(A[0]) == 0 +    or sum(A[1]) == 0 +    or sum(A[2]) == 0 +    or sum(A[:, 0]) == 0 +    or sum(A[:, 1]) == 0 +    or sum(A[:, 2]) == 0 +    or A[0, 0] + A[1, 1] + A[2, 2] == 0 +    or A[2, 0] + A[1, 1] + A[0, 2] == 0 -    ans = "Yes" -print(ans) +    print("Yes") +else: +    print("No")