M=[]
for _i in range(3):
  M.append(list(map(int,input().split())))
n= int(input())
for a in range(n):
  b= int(input())
  for i in range(3):
    for j in range(3):
      if M[i][j]==b:
        M[i][j]=-1
oassiy= False
for i in range(3):
  cont=0
  for j in range(3):
    if M[i][j]==-1:
      cont+=1
  if cont==3:
    break
    oassiy=True

if not oassiy:
 for j in range(3):
  cont=0
  for i in range(3):
    if M[i][j]==-1:
      cont+=1
  if cont==3:
    break
    oassiy=True

if not oassiy:
  cont1 = cont2= 0
  for i in range(3):
    if M[i][i]==-1:
      cont1+=1
    if M[i][2-i]==-1:
      cont2+=1
if (cont1==3) or (cont2==3):
    oassiy=True

print('Yes' if oassiy else 'No')
