def bingo(C):

    if C[0]==C[1]==C[2] and C[0]==1:

        return True

    elif C[3]==C[4]==C[5] and C[3]==1:

        return True

    elif C[6]==C[7]==C[8] and C[6]==1:

        return True

    elif C[0]==C[3]==C[6] and C[0]==1:

        return True

    elif C[1]==C[4]==C[7] and C[1]==1:

        return True

    elif C[2]==C[5]==C[8] and C[2]==1:

        return True

    elif C[0]==C[4]==C[8] and C[0]==1:

        return True

    elif C[2]==C[4]==C[6] and C[2]==1:

        return True   

    else:

        return False



A=[]

for _ in range(3):

    x1,x2,x3=list(map(int, input().split()))

    A.append(x1)

    A.append(x2)

    A.append(x3)



B=[ 0 for _ in range(9) ]



N=eval(input())



for _ in range(N):

    b=eval(input())

    for i,x in enumerate(A):

        if b==x:

            B[i]=1

        



if bingo(B):

    print("Yes")

else:

    print("No")

import sys

A1=list(map(int, sys.stdin.readline().split()))

A2=list(map(int, sys.stdin.readline().split()))

A3=list(map(int, sys.stdin.readline().split()))

A=A1+A2+A3

N=eval(input())



def isbingo():

    if A[0]==A[1]==A[2]==0: return True

    elif A[3]==A[4]==A[5]==0: return True

    elif A[6]==A[7]==A[8]==0: return True

    elif A[0]==A[3]==A[6]==0: return True

    elif A[1]==A[4]==A[7]==0: return True

    elif A[2]==A[5]==A[8]==0: return True

    elif A[0]==A[4]==A[8]==0: return True

    elif A[2]==A[4]==A[6]==0: return True

    else: return False



for _ in range(N):

    b=int(sys.stdin.readline().strip())

    for i,a in enumerate(A):

        if b==a:

            A[i]=0



if isbingo():

    print("Yes")

else:

    print("No")
def bingo(C):
    if C[0] == C[1] == C[2] and C[0] == 1:
        return True
    elif C[3] == C[4] == C[5] and C[3] == 1:
        return True
    elif C[6] == C[7] == C[8] and C[6] == 1:
        return True
    elif C[0] == C[3] == C[6] and C[0] == 1:
        return True
    elif C[1] == C[4] == C[7] and C[1] == 1:
        return True
    elif C[2] == C[5] == C[8] and C[2] == 1:
        return True
    elif C[0] == C[4] == C[8] and C[0] == 1:
        return True
    elif C[2] == C[4] == C[6] and C[2] == 1:
        return True
    else:
        return False


A = []
for _ in range(3):
    x1, x2, x3 = list(map(int, input().split()))
    A.append(x1)
    A.append(x2)
    A.append(x3)
B = [0 for _ in range(9)]
N = eval(input())
for _ in range(N):
    b = eval(input())
    for i, x in enumerate(A):
        if b == x:
            B[i] = 1
if bingo(B):
    print("Yes")
else:
    print("No")

import sys

A1 = list(map(int, sys.stdin.readline().split()))
A2 = list(map(int, sys.stdin.readline().split()))
A3 = list(map(int, sys.stdin.readline().split()))
A = A1 + A2 + A3
N = eval(input())


def isbingo():
    if A[0] == A[1] == A[2] == 0:
        return True
    elif A[3] == A[4] == A[5] == 0:
        return True
    elif A[6] == A[7] == A[8] == 0:
        return True
    elif A[0] == A[3] == A[6] == 0:
        return True
    elif A[1] == A[4] == A[7] == 0:
        return True
    elif A[2] == A[5] == A[8] == 0:
        return True
    elif A[0] == A[4] == A[8] == 0:
        return True
    elif A[2] == A[4] == A[6] == 0:
        return True
    else:
        return False


for _ in range(N):
    b = int(sys.stdin.readline().strip())
    for i, a in enumerate(A):
        if b == a:
            A[i] = 0
if isbingo():
    print("Yes")
else:
    print("No")

-def bingo(C): -    if C[0] == C[1] == C[2] and C[0] == 1: +import sys + +A1 = list(map(int, sys.stdin.readline().split())) +A2 = list(map(int, sys.stdin.readline().split())) +A3 = list(map(int, sys.stdin.readline().split())) +A = A1 + A2 + A3 +N = eval(input()) + + +def isbingo(): +    if A[0] == A[1] == A[2] == 0: -    elif C[3] == C[4] == C[5] and C[3] == 1: +    elif A[3] == A[4] == A[5] == 0: -    elif C[6] == C[7] == C[8] and C[6] == 1: +    elif A[6] == A[7] == A[8] == 0: -    elif C[0] == C[3] == C[6] and C[0] == 1: +    elif A[0] == A[3] == A[6] == 0: -    elif C[1] == C[4] == C[7] and C[1] == 1: +    elif A[1] == A[4] == A[7] == 0: -    elif C[2] == C[5] == C[8] and C[2] == 1: +    elif A[2] == A[5] == A[8] == 0: -    elif C[0] == C[4] == C[8] and C[0] == 1: +    elif A[0] == A[4] == A[8] == 0: -    elif C[2] == C[4] == C[6] and C[2] == 1: +    elif A[2] == A[4] == A[6] == 0: -A = [] -for _ in range(3): -    x1, x2, x3 = list(map(int, input().split())) -    A.append(x1) -    A.append(x2) -    A.append(x3) -B = [0 for _ in range(9)] -N = eval(input()) -    b = eval(input()) -    for i, x in enumerate(A): -        if b == x: -            B[i] = 1 -if bingo(B): +    b = int(sys.stdin.readline().strip()) +    for i, a in enumerate(A): +        if b == a: +            A[i] = 0 +if isbingo():