import math
a1 = list(map(int, input().split())) 
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
a = [a1,a2,a3]

N = int(input())

b = []
for i in range(N) :
    b.append(int(input()))

m = [[0,0,0],[0,0,0],[0,0,0]]

for i in range(N) :
    for j in range(3) :
        for k in range(3) :
            if b[i] == a[j][k] :
                m[j][k] = 1
                
if  m[0].count(1) == 3 or \
    m[1].count(1) == 3 or \
    m[2].count(1) == 3 or \
    [x[0] for x in m].count(1) == 3 or \
    [x[1] for x in m].count(1) == 3 or \
    [x[2] for x in m].count(1) == 3 or \
    (m[0][0] == 1 and m [1][1] == 1 and m [2][2] == 1) or \
    (m[2][0] == 1 and m [1][1] == 1 and m [2][0] == 1) :
    print('Yes')
else :
    print('No')