import numpy as np

a1 = np.zeros(3, dtype=int)

a2 = np.zeros(3, dtype=int)

a3 = np.zeros(3, dtype=int)



for i in range(3):

    a1[i], a2[i], a3[i] = map(int, input().split())



n = int(input())

b = [int(input()) for i in range(n)]



a = np.array([a1, a2, a3]).T.flatten()



for i in range(n):

    a[np.where(a == b[i])] = 0

a = a.reshape(3, -1)



print("Yes") if a[0].sum()==0 or a[1].sum()==0 or a[2].sum()==0 or a[:, 0].sum()==0 or a[:, 1].sum()==0 or a[:, 2].sum()==0 or np.diag(a).sum()==0 or np.diag(a[::-1]).sum()==0 else print("No")

import numpy as np



arr = np.array([list(map(int, input().split())) for _ in range(3)])





n = int(eval(input()))



for _ in range(n):

    b = int(eval(input()))

    arr[np.where(arr == b)] = 0



ans1 = (np.sum(arr, axis=0) == 0).sum() >= 1

ans2 = (np.sum(arr, axis=1) == 0).sum() >= 1

ans3 = (np.diag(arr) == 0).sum() == 3

ans4 = (np.diag(np.rot90(arr)) == 0).sum() == 3



print(("Yes" if ans1 or ans2 or ans3 or ans4 else "No"))
import numpy as np

a1 = np.zeros(3, dtype=int)
a2 = np.zeros(3, dtype=int)
a3 = np.zeros(3, dtype=int)
for i in range(3):
    a1[i], a2[i], a3[i] = map(int, input().split())
n = int(input())
b = [int(input()) for i in range(n)]
a = np.array([a1, a2, a3]).T.flatten()
for i in range(n):
    a[np.where(a == b[i])] = 0
a = a.reshape(3, -1)
print("Yes") if a[0].sum() == 0 or a[1].sum() == 0 or a[2].sum() == 0 or a[
    :, 0
].sum() == 0 or a[:, 1].sum() == 0 or a[:, 2].sum() == 0 or np.diag(
    a
).sum() == 0 or np.diag(
    a[::-1]
).sum() == 0 else print(
    "No"
)

import numpy as np

arr = np.array([list(map(int, input().split())) for _ in range(3)])
n = int(eval(input()))
for _ in range(n):
    b = int(eval(input()))
    arr[np.where(arr == b)] = 0
ans1 = (np.sum(arr, axis=0) == 0).sum() >= 1
ans2 = (np.sum(arr, axis=1) == 0).sum() >= 1
ans3 = (np.diag(arr) == 0).sum() == 3
ans4 = (np.diag(np.rot90(arr)) == 0).sum() == 3
print(("Yes" if ans1 or ans2 or ans3 or ans4 else "No"))

-a1 = np.zeros(3, dtype=int) -a2 = np.zeros(3, dtype=int) -a3 = np.zeros(3, dtype=int) -for i in range(3): -    a1[i], a2[i], a3[i] = map(int, input().split()) -n = int(input()) -b = [int(input()) for i in range(n)] -a = np.array([a1, a2, a3]).T.flatten() -for i in range(n): -    a[np.where(a == b[i])] = 0 -a = a.reshape(3, -1) -print("Yes") if a[0].sum() == 0 or a[1].sum() == 0 or a[2].sum() == 0 or a[ -    :, 0 -].sum() == 0 or a[:, 1].sum() == 0 or a[:, 2].sum() == 0 or np.diag( -    a -).sum() == 0 or np.diag( -    a[::-1] -).sum() == 0 else print( -    "No" -) +arr = np.array([list(map(int, input().split())) for _ in range(3)]) +n = int(eval(input())) +for _ in range(n): +    b = int(eval(input())) +    arr[np.where(arr == b)] = 0 +ans1 = (np.sum(arr, axis=0) == 0).sum() >= 1 +ans2 = (np.sum(arr, axis=1) == 0).sum() >= 1 +ans3 = (np.diag(arr) == 0).sum() == 3 +ans4 = (np.diag(np.rot90(arr)) == 0).sum() == 3 +print(("Yes" if ans1 or ans2 or ans3 or ans4 else "No"))