A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
N = int(input())
b = [int(input()) for _ in range(N)]

cnt1 = 0
for i in A1:
    if i in b:
        cnt1 += 1
    if cnt1 == 3:
        flag1 = 1
    else:
        flag1 = 0

cnt2 = 0
for i in A2:
    if i in b:
        cnt2 += 1
    if cnt2 == 3:
        flag2 = 1
    else:
        flag2 = 0

cnt3 = 0
for i in A3:
    if i in b:
        cnt3 += 1
    if cnt3 == 3:
        flag3 = 1
    else:
        flag3 = 0

cnt4 = 0
for i in [A1[0], A2[1], A3[2]]:
    if i in b:
        cnt4 += 1
    if cnt4 == 3:
        flag4 = 1
    else:
        flag4 = 0

cnt5 = 0
for i in [A1[2], A2[1], A3[0]]:
    if i in b:
        cnt5 += 1
    if cnt5 == 3:
        flag5 = 1
    else:
        flag5 = 0

cnt6 = 0
for i in [A1[0], A2[0], A3[0]]:
    if i in b:
        cnt6 += 1
    if cnt6 == 3:
        flag6 = 1
    else:
        flag6 = 0

cnt7 = 0
for i in [A1[1], A2[1], A3[1]]:
    if i in b:
        cnt7 += 1
    if cnt7 == 3:
        flag7 = 1
    else:
        flag7 = 0

cnt8 = 0
for i in [A1[2], A2[2], A3[2]]:
    if i in b:
        cnt8 += 1
    if cnt8 == 3:
        flag8 = 1
    else:
        flag8 = 0

if flag1 == 1 or flag2 == 1 or flag3 == 1 or flag4 == 1 or flag5 == 1 or flag6 == 1 or flag7 == 1 or flag8 == 1:
    print('Yes')
else:
    print('No')
