a = [list(map(int, input().split())) for i in range(3)]
aa = list(zip(*a))
n = int(input())
b = [int(input()) for _ in range(n)]
if a[0] in b or a[1] in b or a[2] in b or aa[0] in b or aa[1] in b or aa[2] in b or (a[0][0] in b and a[1][1] in b and a[2][2] in b) or (a[0][2] in b and a[1][1] in b and a[2][0] in b):
    print('Yes')
else:
    print('No')