from collections import Counter

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()))

for _ in range(N):

  b=int(eval(input()))

  #穴をあける

  for tmpA in A:

    if b in tmpA:

      index=tmpA.index(b)

      tmpA[index]=-1

      break

  

#bingoチェック

  

#たて

if A[0][0]==A[1][0] and A[1][0]==A[2][0] or A[0][1]==A[1][1] and A[1][1]==A[2][1] or A[0][2]==A[1][2]and A[1][2]==A[2][2]:

  print("Yes")

#よこ

elif len(Counter(A[0]))==1 or len(Counter(A[1]))==1 or len(Counter(A[2]))==1:

  print("Yes")

#ななめ

elif A[1][1]==-1 and (A[0][0] == A[2][2] or A[0][2]==A[2][0]):

  print("Yes")

#ダメ

else:

  print("No")
from collections import Counter

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()))

for _ in range(N):

  b=int(eval(input()))

  #穴をあける

  for tmpA in A:

    if b in tmpA:

      index=tmpA.index(b)

      tmpA[index]=-1

      break

  

#bingoチェック

  

#たて

if True in [A[0][i]==A[1][i] and A[1][i]==A[2][i] for i in range(3)]:

  print("Yes")

#よこ

elif len(Counter(A[0]))==1 or len(Counter(A[1]))==1 or len(Counter(A[2]))==1:

  print("Yes")

#ななめ

elif A[1][1]==-1 and (A[0][0] == A[2][2] or A[0][2]==A[2][0]):

  print("Yes")

#ダメ

else:

  print("No")

from collections import Counter

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()))
for _ in range(N):
    b = int(eval(input()))
    # 穴をあける
    for tmpA in A:
        if b in tmpA:
            index = tmpA.index(b)
            tmpA[index] = -1
            break
# bingoチェック
# たて
if (
    A[0][0] == A[1][0]
    and A[1][0] == A[2][0]
    or A[0][1] == A[1][1]
    and A[1][1] == A[2][1]
    or A[0][2] == A[1][2]
    and A[1][2] == A[2][2]
):
    print("Yes")
# よこ
elif len(Counter(A[0])) == 1 or len(Counter(A[1])) == 1 or len(Counter(A[2])) == 1:
    print("Yes")
# ななめ
elif A[1][1] == -1 and (A[0][0] == A[2][2] or A[0][2] == A[2][0]):
    print("Yes")
# ダメ
else:
    print("No")

from collections import Counter

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()))
for _ in range(N):
    b = int(eval(input()))
    # 穴をあける
    for tmpA in A:
        if b in tmpA:
            index = tmpA.index(b)
            tmpA[index] = -1
            break
# bingoチェック
# たて
if True in [A[0][i] == A[1][i] and A[1][i] == A[2][i] for i in range(3)]:
    print("Yes")
# よこ
elif len(Counter(A[0])) == 1 or len(Counter(A[1])) == 1 or len(Counter(A[2])) == 1:
    print("Yes")
# ななめ
elif A[1][1] == -1 and (A[0][0] == A[2][2] or A[0][2] == A[2][0]):
    print("Yes")
# ダメ
else:
    print("No")

-if ( -    A[0][0] == A[1][0] -    and A[1][0] == A[2][0] -    or A[0][1] == A[1][1] -    and A[1][1] == A[2][1] -    or A[0][2] == A[1][2] -    and A[1][2] == A[2][2] -): +if True in [A[0][i] == A[1][i] and A[1][i] == A[2][i] for i in range(3)]: