bingo = []
for _ in range(3):
    bingo.append(list(map(int,input().split())))

cl = [[0,0,0],[0,0,0],[0,0,0]]

n = int(input())
st = set()
for _ in range(n):
    st.add(int(input()))

for _ in range(len(st)):
    for i in range(3):
        for j in range(3):
            if bingo[i][j] in st:
                cl[i][j] = 1

if sum(cl[0]) == 3 or sum(cl[1]) == 3 or sum(cl[2]) == 3:
    print('Yes')
elif sum(cl[:][0]) == 3 or sum(cl[:][1]) == 3 or sum(cl[:][2]) == 3:
    print('Yes')
elif cl[0][0]+cl[1][1]+cl[2][2] == 3 or cl[0][2]+cl[1][1]+cl[0][2] == 3:
    print('Yes')
else:
    print('No')