A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
N = int(input())
i = 0
j = 0
k = 0

while N > 0:
  dice = int(input())
  while i < 3:
    if A[i] == int(dice):
      A[i] = "z"
      i = i + 1
  while j < 3:
    if B[j] == dice:
      B[j] = "z"
      j = j + 1
  while k < 3:
    if C[k] == dice:
      C[k] = "z"
      k = k + 1
  N = N - 1
      
if A[0] == A[1] == A[2] == "z" or B[0] == B[1] == B[2] == "z" or C[0] == C[1] == C[2] == "z" or A[0] == B[0] == C[0] == "z" or A[1] == B[1] == C[1] == "z" or A[2] == B[2] == C[2] == "z" or A[0] == B[1] == C[2] == "z" or A[2] == B[1] == C[0] == "z":
  print("Yes")
else:
  print("No")