    op = [list(map(int, inp.split())) for inp in open(0)]
    a = [op[0], op[1], op[2]]
    n = int(op[3][0])
    b = []
    for i in range(n):
      b.append(int(op[4 + i][0]))
      for j in range(3):
        for k in range(3):
          if a[j][k] == b[i]:
            a[j][k] = -1
    res = 'No'
    for i in range(3):
      if a[0][i] == a[1][i] == a[2][i] == -1:
        res = 'Yes'
      if a[i][0] == a[i][1] == a[i][2] == -1:
        res = 'Yes'
    if a[0][0] == a[1][1] == a[2][2] == -1:
      res = 'Yes'
    if a[2][0] == a[1][1] == a[0][2] == -1:
      res = 'Yes'
    print(res)