A11,A12,A13 = map(int, input().split())
A21,A22,A23 = map(int, input().split())
A31,A32,A33 = map(int, input().split())
N = int(input())
b = [int(input()) for _ in range(N)]

cnt11=0
cnt12=0
cnt13=0
cnt21=0
cnt22=0
cnt23=0
cnt31=0
cnt32=0
cnt33=0

for i in range(N):
    if b[i]==A11:
        cnt11+=1
    elif b[i]==A12:
        cnt12+=1
    elif b[i]==A13:
        cnt13+=1
    elif b[i]==A21:
        cnt21+=1
    elif b[i]==A22:
        cnt22+=1
    elif b[i]==A23:
        cnt23+=1
    elif b[i]==A31:
        cnt31+=1
    elif b[i]==A32:
        cnt32+=1
    elif b[i]==A33:
        cnt33+=1
    else:
        pass

bingo=0
if cnt11>0:
    if((cnt12>0 and cnt13>0)or(cnt22>0 and cnt33>0)or(cnt21>0 and cnt31>0)):
        bingo+=1
    else:
        pass
elif cnt12>0:
    if (cnt22>0 and cnt32>0):
        bingo+=1
    else:
        pass
elif cnt13>0:
    if((cnt22>0 and cnt31>0)or(cnt23>0 and cnt33>0)):
        bingo+=1
    else:
        pass
elif cnt21>0:
    if(cnt22>0 and cnt23>0):
        bingo+=1
    else:
        pass
elif cnt31>0:
    if(cnt32>0 and cnt33>0):
        bingo+=1
    else:
        pass
else:
    pass
if bingo>0:
    print('Yes')
else:
    print('No')