A=[list(map(int,input().split())) for i in range(3)]
AB=[[0 for i in range(3)] for j in range(3)]
N=int(input())
for i in range(N):
    x=int(input())
    for j in range(3):
        for k in range(3):
            if A[j][k]==x:
                AB[j][k]=1
c=1
for i in range(3):
    if AB[i][0]*AB[i][1]*AB[i][2]==1:
        c=0
        break
    if AB[0][i]*AB[1][i]*AB[2][i]==1:
        c=0
        break
    if AB[0][0]*AB[1][1]*AB[2][2]==1:
        c=0
        break
    if AB[0][2]*AB[1][1]*AB[2][0]==1:
        c=0
        break
        

if c==1:
    print("No")
else:
  	print("Yes")