A11, A12, A13 = (int(x) for x in input().split())
A21, A22, A23 = (int(x) for x in input().split())
A31, A32, A33 = (int(x) for x in input().split())

N = int(input())

b_list = list()
for i in range(0, N):
    i = int(input())
    b_list.append(i)

A_list = [A11, A12, A13, A21, A22, A23, A31, A32, A33]

for b in b_list:
    for i in range(0, 9):
        if A_list[i] == b:
            A_list[i] = 0

X, Y, Z = 0, 0, 0
for i in range(0, 3):
    k = 3 * i
    if A_list[k] + A_list[k + 1] + A_list[k + 2] == 0:
        X = X + 1
    elif A_list[i] + A_list[i + 3] + A_list[i + 6] == 0:
        Y = Y + 1
    elif A_list[0] + A_list[4] + A_list[8] == 0:
        Z = Z + 1
    elif A_list[2] + A_list[4] + A_list[6] == 0:
        Z = Z + 1
    else:
        continue

if (X+Y+Z) >= 1:
    print('Yes')
else:
    print('No')