import numpy as np
N = []
FLAGS = True
for i in range(3):
  N1 = list(map(int, input().split(' ')))
  N.append(N1)

N = np.array(N)

M = int(input())

for i in range(M):
  a = int(input())
  
  for j in range(3):
    for k in range(3):
      if N[j, k] == a:
        N[j, k] = 0
  if (np.all(N == 0, axis = 0).any(0)) or (np.all(N == 0, axis = 1).any(0)) or (np.all(np.diag(N) == 0).any(0)) or (np.all(np.diag(N) == 0).any(0)):
  #if (N[0, :].all() == 0) or (N[1, :].all() == 0) or  (N[2, :].all() == 0) or  (N[:, 0].all() == 0) or (N[:, 1].all() == 0) or (N[:, 2].all() == 0) or (np.diag(N).all() == 0) or (np.diag(np.transpose(N)).all() == 0):
    print('Yes')
    FLAGS = True
    break
  else:
    FLAGS = False
    continue
      
if FLAGS == False:     
  print('No')
                                                                
                       