num=[[]]
for i in range(3):
    array = list(map(int, input().strip().split()))
    num.append(array)
N = int(input())
a = [int(input()) for i in range(N)]

for i in range(N):
    for j in range(3):
        for k in range(3):
            if a[i] == num[j][k]:
                num[j][k] = False
bingo = 0
for m in range(3):
    if num[0][m] == num[1][m] == num[2][m] == False:bingo = 1

for n in range(3):
    if num[n][0] ==  num[n][1] ==  num[n][2] == 0:bingo = 1 
if num[0][0] == num[1][1] == num[2][2] == 0 :bingo = 1
if num[0][2] == num[1][1] == num[2][0] == 0 :bingo = 1

if bingo == 1:print("Yes")
elif bingo == 0:print("No")


