import numpy as np
x = input()
y = input()
z = input()
xa = x.split(" ")
ya = y.split(" ")
za = z.split(" ")
A = np.array([xa,ya,za])
N = int(input())
b =[]
C = np.array([["Nomark", "Nomark", "Nomark"],["Nomark", "Nomark", "Nomark"],["Nomark", "Nomark", "Nomark"]])
for i in range(1,N+1):
    b.append(input())
for m in range(0,3):
    for n in range(0,3):
        if A[m, n] in b:
            C[m,n] = "Maru"
tate = str(np.count_nonzero(C == 'Maru', axis=0))

yoko = str(np.count_nonzero(C == 'Maru', axis=1))

if "3" in tate or "3" in yoko:
    print('Yes')
elif C[0,0] == "Maru" and C[1,1] == "Maru" and C[2,2] == "Maru":
    print("Yes")
elif C[0,2] == "Maru" and C[1,1] == "Maru" and C[2,0] == "Maru":
    print("Yes")
else:
    print("No")