import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
# print(a)
# print(b)
# print(c)
n = int(input())
d = [int(input()) for i in range(n)]
# print(d)

if (a[0]in d) and (a[1]in d) and(a[2]in d):
    print("Yes")
    exit()
if (b[0]in d)and(b[1]in d)and(b[2]in d):
    print("Yes")
    exit()
if (c[0]in d)and(c[1]in d)and(c[2]in d):
    print("Yes")
    exit()
if (a[2]in d)and(b[1]in d)and(c[0]in d):
    print("Yes")
    exit()
if (a[0]in d)and(b[1]in d)and(c[2]in d):
    print("Yes")
    exit()
if (a[0]in d)and(b[0]in d)and(c[0]in d):
    print("Yes")
    exit()
if (a[2]in d)and(b[2]in d)and(c[2]in d):
    print("Yes")
    exit()
else:
    print("No")
