a = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]

c = [[0 for _ in range(3)] for _ in range(3)]
result = ""

for i in range(3):
    for j in range(3):
        if a[j][i] in b:
            c[j][i] = 1

for i in range(3):
    if c[i][0] == c[i][1] == c[i][2] == 1:
        result = "Yes"
        break
    elif c[0][i] == c[1][i] == c[2][i] == 1:
        result = "Yes"
        break

if c[0][0] == c[1][1] == c[2][2] == 1:
    result = "Yes"
elif c[0][2] == c[1][1] == c[2][0] == 1:
    result = "Yes"

if result == "":
    result ="No"

print(result)
