x = [0] * 3

y = [0] * 3

z = [0] * 3

for i in range(3):

    x[i], y[i], z[i] = list(map(int, input().split()))



n = int(eval(input()))

b = [int(eval(input())) for _ in range(n)]

ans = [x, y, z]



for i in range(3):

    ans.append([x[i], y[i], z[i]])



ans.append([x[0], y[1], z[2]])

ans.append([x[2], y[1], z[0]])



cnt_list = []

for i in range(len(ans)):

    cnt = 0

    for j in list(set(x + y + z) & set(b)):

        if j in ans[i]:

            cnt += 1

    cnt_list.append(cnt)



for cnt in cnt_list:

  if cnt >= 3:

    print('Yes')

    exit()

 

print('No')
a=[list(map(int,list(input().split()))) for _ in range(3)]

b=[[0]*3 for _ in range(3)] 

n = int(eval(input()))

##################

for ni in range(n):

  x = int(eval(input()))

  for i in range(3):

    for j in range(3):

      if a[i][j] == x:

        b[i][j] = 1

##################

ans = False

##################

for i in range(3):

  cnt = 0

  for j in range(3):

    cnt += b[i][j]

    if cnt == 3:

      ans = True

##################

for i in range(3):

  cnt = 0

  for j in range(3):

    cnt += b[j][i]

    if cnt == 3:

      ans = True

##################

cnt = 0

for j in range(3):

  cnt += b[j][j]

  if cnt == 3:

    ans = True

##################

cnt = 0

for j in range(3):

  cnt += b[j][2-j]

  if cnt == 3:

    ans = True

##################

if ans == True:

  print('Yes')

else:

  print('No')

x = [0] * 3
y = [0] * 3
z = [0] * 3
for i in range(3):
    x[i], y[i], z[i] = list(map(int, input().split()))
n = int(eval(input()))
b = [int(eval(input())) for _ in range(n)]
ans = [x, y, z]
for i in range(3):
    ans.append([x[i], y[i], z[i]])
ans.append([x[0], y[1], z[2]])
ans.append([x[2], y[1], z[0]])
cnt_list = []
for i in range(len(ans)):
    cnt = 0
    for j in list(set(x + y + z) & set(b)):
        if j in ans[i]:
            cnt += 1
    cnt_list.append(cnt)
for cnt in cnt_list:
    if cnt >= 3:
        print("Yes")
        exit()
print("No")

a = [list(map(int, list(input().split()))) for _ in range(3)]
b = [[0] * 3 for _ in range(3)]
n = int(eval(input()))
##################
for ni in range(n):
    x = int(eval(input()))
    for i in range(3):
        for j in range(3):
            if a[i][j] == x:
                b[i][j] = 1
##################
ans = False
##################
for i in range(3):
    cnt = 0
    for j in range(3):
        cnt += b[i][j]
        if cnt == 3:
            ans = True
##################
for i in range(3):
    cnt = 0
    for j in range(3):
        cnt += b[j][i]
        if cnt == 3:
            ans = True
##################
cnt = 0
for j in range(3):
    cnt += b[j][j]
    if cnt == 3:
        ans = True
##################
cnt = 0
for j in range(3):
    cnt += b[j][2 - j]
    if cnt == 3:
        ans = True
##################
if ans == True:
    print("Yes")
else:
    print("No")

-x = [0] * 3 -y = [0] * 3 -z = [0] * 3 +a = [list(map(int, list(input().split()))) for _ in range(3)] +b = [[0] * 3 for _ in range(3)] +n = int(eval(input())) +################## +for ni in range(n): +    x = int(eval(input())) +    for i in range(3): +        for j in range(3): +            if a[i][j] == x: +                b[i][j] = 1 +################## +ans = False +################## -    x[i], y[i], z[i] = list(map(int, input().split())) -n = int(eval(input())) -b = [int(eval(input())) for _ in range(n)] -ans = [x, y, z] +    cnt = 0 +    for j in range(3): +        cnt += b[i][j] +        if cnt == 3: +            ans = True +################## -    ans.append([x[i], y[i], z[i]]) -ans.append([x[0], y[1], z[2]]) -ans.append([x[2], y[1], z[0]]) -cnt_list = [] -for i in range(len(ans)): -    for j in list(set(x + y + z) & set(b)): -        if j in ans[i]: -            cnt += 1 -    cnt_list.append(cnt) -for cnt in cnt_list: -    if cnt >= 3: -        print("Yes") -        exit() -print("No") +    for j in range(3): +        cnt += b[j][i] +        if cnt == 3: +            ans = True +################## +cnt = 0 +for j in range(3): +    cnt += b[j][j] +    if cnt == 3: +        ans = True +################## +cnt = 0 +for j in range(3): +    cnt += b[j][2 - j] +    if cnt == 3: +        ans = True +################## +if ans == True: +    print("Yes") +else: +    print("No")