A_list1 = list(map(int, input().split()))
A_list2 = list(map(int, input().split()))
A_list3 = list(map(int, input().split()))
N = int(input())
B_list = []
for i in range(N):
    B_list.append(int(input()))

A_list1_c = []
A_list2_c = []
A_list3_c = []
for i in B_list:
    if i in A_list1:
        A_list1_c.append(A_list1.index(i))
    if i in A_list2:
        A_list2_c.append(A_list2.index(i))
    if i in A_list3:
        A_list3_c.append(A_list3.index(i))

for i in A_list1_c:
    if i in A_list2_c and i in A_list3_c:
        print("Yes")
        exit()
    if i == 0:
        if 1 in A_list2_c:
            if 2 in A_list3_c:
                print("Yes")
                exit()
    if i == 2:
        if 1 in A_list2_c:
            if 0 in A_list3_c:
                print("Yes")
                exit()
if len(A_list1_c) == 3 or len(A_list2_c) == 3 or len(A_list3_c) == 3:
    print("Yes")
    exit()

print("No")
