List = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]

ans = [[0,0,0] for i in range(3)]
ans1 = [[0,0,0] for i in range(3)]

res = False

for i in range(n):
    for a in range(3):
        for c in range(3):
            if b[n] == List[a][c]:
                ans[a][c] = 1
                ans1[c][a] = 1
                
if ans[1][1] == 1:
    if ans[0][0] > 0 and ans[2][2] > 0:
        res = True
    if ans[2][0] > 0 and ans[0][2] > 0:
        res = True
                
for i in range(3):
    if ans[i][0] > 0 and ans[i][1] > 0 and ans[i][2] > 0:
        res = True
    if ans1[i][0] > 0 and ans1[i][1] > 0 and ans1[i][2] > 0:
        res = True
   
            
if res:
    print('Yes')
else:
    print('No')