bingo = [list(map(int, input().split(" "))) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]

#list = [[0] * 3] * 3
list = [ [0]*3 for x in range( 0, 3 ) ]
flag = 0

# print(list)

for i in range(0, 3):
    for j in range(0, 3):
        for k in range(0, N):
            if bingo[i][j] == b[k]:
                list[i][j] = 1
                #print(list)
                #print(b[k])
# print(list)
# list = [[1,0,0], [1, 1, 0], [0,0,1]]

for i in range(0, 3):
    hantei = 0
    for j in range(0, 3):
        hantei = hantei + list[i][j]
    if hantei == 3:
        flag = 1
        break

for i in range(0, 3):
    hantei = 0
    for j in range(0, 3):
        hantei = hantei + list[j][i]
    if hantei == 3:
        flag = 1
        break

hantei = 0
for i in range(0, 3):
    hantei = hantei + list[i][i]
if hantei == 3:
    flag = 1

hantei = 0
for i in range(0, 3):
    hantei = hantei + list[i][2 - i]
if hantei == 3:
    flag = 1

if flag == 1:
    print('Yes')
elif flag == 0:
    print('No')
    