a = [list(map(int,input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for number in b:
    if b in a:
        a[a.index(b)] = 0
if a[0][0] == a[1][1] == a[2][2]:
    print('Yes')
else:
    for i in range(3):
        if a[i][0] == a[i][1] == a[i][2]:
            print('Yes')
            break
        elif a[0][i] == a[1][i] == a[2][i]:
            print('Yes')
            break
    else:
        print('No')