A = []

for _ in range(3):
    lis=list(map(int,input().split()))
    A.append(lis)

N = int(input())
ans=[]
for _ in range(N):
    b=int(input())
    for i in range(3):
        if(b in A[i]):
            ans.append([i+1,A[i].index(b)+1])
            break
tate=False
if(ans == []):
    print("No")
else:
    counter1=[0,0,0]
    counter2=[0,0,0]
    counter3=0
    for a in ans:
        if(a[0]==1):
            counter1[0]+=1
        elif(a[0] == 2):
            counter1[1]+=1
        elif(a[0] == 3):
            counter1[2]+=1

        if(a[1] == 1):
            counter2[0]+=1
        elif(a[1] == 2):
            counter2[1]+=1
        elif(a[1] == 3):
            counter2[2]+=1
        if(a[0] == a[1] or a[0] == 1 and a[1] == 3 or a[1]==1 and a[0]==3):
            counter3+=1

    if(3 in counter1 or 3 in counter2 or counter3 >=3):
        print("Yes")
    else:
        print("No")
