dp = [[0]*3 for i in range(3)]
L = []
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
L = [a,b,c]
n = int(input())
l = []
for i in range(n):
    l.append(int(input()))

flag = 0 

for i in range(3):
    for j in range(3):
        if L[i][j] in l:
            dp[i][j] = 1
# dp = [[1,1,0],[0,1,0],[1,0,1]]
for i in range(3):
    if sum(dp[i]) ==3:
        flag = 1

for j in range(3):
    s = 0
    for i in range(3):
        s+= dp[i][j]
    if s == 3:
        flag = 1
s = 0
t = 0
for i in range(3):
    s+=  dp[i][i]
    t+= dp[i][2-i]
if s==3 or t == 3:
    flag = 1
    
if flag:
    print('Yes')
else:
    print('No')
# print(dp)