a = list(map(int, input().split())
a += list(map(int, input().split())
a += list(map(int, input().split())
A = []
N = int(input())
b = list(int(input()) for i in range(N))

for i in range(9):
    if a[i] in b[i]:
        A[i] = "maru"

if A[0] == A[1] == A[2] or A[3] == A[4] == A[5] or A[6] == A[7] == A[8] or A[2] == A[4] == A[6]:
    print("yes")
elif A[0] == A[3] == A[6] or A[1] == A[4] == A[7] or A[2] == A[5] == A[8]:
    print("yes")
else:
    print("no")  