import sys

from pprint import pprint



bingo = [[] for _ in range(3)]

for i in range(3):

    bingo[i] = list(map(int, sys.stdin.readline().strip().split()))



N = int(sys.stdin.readline().strip())

B = set()

for _ in range(N):

    B.add(int(sys.stdin.readline().strip()))



bingo_flag = False

for i in range(3):

    tmp = []

    for j in range(3):

        if bingo[i][j] not in B:

            break

    else:

        bingo_flag = True



for i in range(3):

    for j in range(3):

        if bingo[j][i] not in B:

            break

    else:

        bingo_flag = True



for i in range(3):

    if bingo[i][i] not in B:

        break

else:

    bingo_flag = True



for i in range(3):

    if bingo[2-i][i] not in B:

        break

else:

    bingo_flag = True





if bingo_flag:

    print("Yes")

else:

    print("No")
import sys



input = sys.stdin.readline



bingo = []

for _ in range(3):

    bingo.append(list(map(int, input().split())))



N = int(eval(input()))

nums = []

for _ in range(N):

    nums.append(int(eval(input())))



for num in nums:

    for i in range(3):

        for j in range(3):

            if bingo[i][j] == num:

                bingo[i][j] = -1



for i in range(3):

    if sum(bingo[i]) == -3:

        print("Yes")

        sys.exit()

    tmp = 0

    for j in range(3):

        tmp += bingo[j][i]

    if tmp == -3:

        print("Yes")

        sys.exit()

if bingo[0][0] == -1 and bingo[1][1] == -1 and bingo[2][2] == -1:

    print("Yes")

    sys.exit()

if bingo[0][2] == -1 and bingo[1][1] == -1 and bingo[0][2] == -1:

    print("Yes")

    sys.exit()



print("No")
import sys
from pprint import pprint

bingo = [[] for _ in range(3)]
for i in range(3):
    bingo[i] = list(map(int, sys.stdin.readline().strip().split()))
N = int(sys.stdin.readline().strip())
B = set()
for _ in range(N):
    B.add(int(sys.stdin.readline().strip()))
bingo_flag = False
for i in range(3):
    tmp = []
    for j in range(3):
        if bingo[i][j] not in B:
            break
    else:
        bingo_flag = True
for i in range(3):
    for j in range(3):
        if bingo[j][i] not in B:
            break
    else:
        bingo_flag = True
for i in range(3):
    if bingo[i][i] not in B:
        break
else:
    bingo_flag = True
for i in range(3):
    if bingo[2 - i][i] not in B:
        break
else:
    bingo_flag = True
if bingo_flag:
    print("Yes")
else:
    print("No")

import sys

input = sys.stdin.readline
bingo = []
for _ in range(3):
    bingo.append(list(map(int, input().split())))
N = int(eval(input()))
nums = []
for _ in range(N):
    nums.append(int(eval(input())))
for num in nums:
    for i in range(3):
        for j in range(3):
            if bingo[i][j] == num:
                bingo[i][j] = -1
for i in range(3):
    if sum(bingo[i]) == -3:
        print("Yes")
        sys.exit()
    tmp = 0
    for j in range(3):
        tmp += bingo[j][i]
    if tmp == -3:
        print("Yes")
        sys.exit()
if bingo[0][0] == -1 and bingo[1][1] == -1 and bingo[2][2] == -1:
    print("Yes")
    sys.exit()
if bingo[0][2] == -1 and bingo[1][1] == -1 and bingo[0][2] == -1:
    print("Yes")
    sys.exit()
print("No")

-from pprint import pprint -bingo = [[] for _ in range(3)] +input = sys.stdin.readline +bingo = [] +for _ in range(3): +    bingo.append(list(map(int, input().split()))) +N = int(eval(input())) +nums = [] +for _ in range(N): +    nums.append(int(eval(input()))) +for num in nums: +    for i in range(3): +        for j in range(3): +            if bingo[i][j] == num: +                bingo[i][j] = -1 -    bingo[i] = list(map(int, sys.stdin.readline().strip().split())) -N = int(sys.stdin.readline().strip()) -B = set() -for _ in range(N): -    B.add(int(sys.stdin.readline().strip())) -bingo_flag = False -for i in range(3): -    tmp = [] +    if sum(bingo[i]) == -3: +        print("Yes") +        sys.exit() +    tmp = 0 -        if bingo[i][j] not in B: -            break -    else: -        bingo_flag = True -for i in range(3): -    for j in range(3): -        if bingo[j][i] not in B: -            break -    else: -        bingo_flag = True -for i in range(3): -    if bingo[i][i] not in B: -        break -else: -    bingo_flag = True -for i in range(3): -    if bingo[2 - i][i] not in B: -        break -else: -    bingo_flag = True -if bingo_flag: +        tmp += bingo[j][i] +    if tmp == -3: +        print("Yes") +        sys.exit() +if bingo[0][0] == -1 and bingo[1][1] == -1 and bingo[2][2] == -1: -else: -    print("No") +    sys.exit() +if bingo[0][2] == -1 and bingo[1][1] == -1 and bingo[0][2] == -1: +    print("Yes") +    sys.exit() +print("No")