import copy

A = []
for x in range(3):
 A.append(list(map(int,input().split())))

A_rep = copy.deepcopy(A)

N = int(input())

B = []
for x in range(N):
    B.append(int(input()))
    #B = int(input())

for x in range(3):   
    for y in range(3):
        for z in B:
            if A_rep[x][y] == z:
                A_rep[x][y] = -1

#print(A)
#print(A_rep)
#print(B)

for x in range(3):
    if max(A_rep[x]) == -1:
        print("Yes")
        exit()

if A_rep[0][0] == -1 and A_rep[1][0] == -1 and A_rep[2][0] == -1:
    print("Yes")
    exit()

if A_rep[0][1] == -1 and A_rep[1][1] == -1 and A_rep[2][1] == -1:
    print("Yes")
    exit()

if A_rep[0][2] == -1 and A_rep[1][2] == -1 and A_rep[2][2] == -1:
    print("Yes")
    exit()


if A_rep[0][0] == -1 and A_rep[1][1] == -1 and A_rep[2][2] == -1:
    print("Yes")
    exit()

if A_rep[0][2] == -1 and A_rep[1][1] == -1 and A_rep[2][0] == -1:
    print("Yes")
    exit()

print("No")





