

num = [input().split() for l in range(2)]
N = int(input())
a = [int(input()) for i in range(N)]

for i in range(N):
    for j in range(2):
        for k in range(2):
            if a[i] == num[j][k]:
                num[j][k] = 0 
bingo = 0
for m in range(2):
    if a[0][m] == 0 and a[1][m] == 0 and a[2][m] == 0:bingo = 1

for n in range(2):
    if a[n][0] == 0 and a[n][1] == 0 and a[n][2] == 0:bingo = 1 
if a[0][0] == a[1][1] == a[2][2] == 0 :bingo = 1
if a[0][2] == a[1][1] == a[2][0] == 0 :bingo = 1

if bingo == 1:print("Yes")
elif bingo == 0:print("No")


