def f():

  a1 = list(map(int, input().split()))

  a2 = list(map(int, input().split()))

  a3 = list(map(int, input().split()))

  A = a1+a2+a3



  N = int(eval(input()))



  c = [False]*9



  for i in range(N):

    b = int(eval(input()))

    if b in A:

      c[A.index(b)] = True



  for i in range(3):

    if c[i] and c[3+i] and c[6+i]:

      return 'Yes'

    elif c[3*i] and c[3*i+1] and c[3*i+2]:

      return 'Yes'



  if c[0] and c[4] and c[8]:

    return 'Yes'

  elif c[2] and c[4] and c[6]:

    return 'Yes'



  return 'No'

print((f()))
*A, = list(map(int, open(0).read().split()))

N = A[9]

B = A[10:]

A = A[:9]



T = [False]*9



for b in B:

    if b in A:

        T[A.index(b)] = True



bingo = [(0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6),

         (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)]



for a, b, c in bingo:

    if T[a] and T[b] and T[c]:

        print('Yes')

        break

else:

    print('No')

def f():
    a1 = list(map(int, input().split()))
    a2 = list(map(int, input().split()))
    a3 = list(map(int, input().split()))
    A = a1 + a2 + a3
    N = int(eval(input()))
    c = [False] * 9
    for i in range(N):
        b = int(eval(input()))
        if b in A:
            c[A.index(b)] = True
    for i in range(3):
        if c[i] and c[3 + i] and c[6 + i]:
            return "Yes"
        elif c[3 * i] and c[3 * i + 1] and c[3 * i + 2]:
            return "Yes"
    if c[0] and c[4] and c[8]:
        return "Yes"
    elif c[2] and c[4] and c[6]:
        return "Yes"
    return "No"


print((f()))

(*A,) = list(map(int, open(0).read().split()))
N = A[9]
B = A[10:]
A = A[:9]
T = [False] * 9
for b in B:
    if b in A:
        T[A.index(b)] = True
bingo = [
    (0, 1, 2),
    (3, 4, 5),
    (6, 7, 8),
    (0, 3, 6),
    (1, 4, 7),
    (2, 5, 8),
    (0, 4, 8),
    (2, 4, 6),
]
for a, b, c in bingo:
    if T[a] and T[b] and T[c]:
        print("Yes")
        break
else:
    print("No")

-def f(): -    a1 = list(map(int, input().split())) -    a2 = list(map(int, input().split())) -    a3 = list(map(int, input().split())) -    A = a1 + a2 + a3 -    N = int(eval(input())) -    c = [False] * 9 -    for i in range(N): -        b = int(eval(input())) -        if b in A: -            c[A.index(b)] = True -    for i in range(3): -        if c[i] and c[3 + i] and c[6 + i]: -            return "Yes" -        elif c[3 * i] and c[3 * i + 1] and c[3 * i + 2]: -            return "Yes" -    if c[0] and c[4] and c[8]: -        return "Yes" -    elif c[2] and c[4] and c[6]: -        return "Yes" -    return "No" - - -print((f())) +(*A,) = list(map(int, open(0).read().split())) +N = A[9] +B = A[10:] +A = A[:9] +T = [False] * 9 +for b in B: +    if b in A: +        T[A.index(b)] = True +bingo = [ +    (0, 1, 2), +    (3, 4, 5), +    (6, 7, 8), +    (0, 3, 6), +    (1, 4, 7), +    (2, 5, 8), +    (0, 4, 8), +    (2, 4, 6), +] +for a, b, c in bingo: +    if T[a] and T[b] and T[c]: +        print("Yes") +        break +else: +    print("No")