We have a bingo card with a 3\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.
The MC will choose N numbers, b_1, b_2, \cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.
Determine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq A_{i, j} \leq 100
 - A_{i_1, j_1} \neq A_{i_2, j_2} ((i_1, j_1) \neq (i_2, j_2))
 - 1 \leq N \leq 10
 - 1 \leq b_i \leq 100
 - b_i \neq b_j (i \neq j)

-----Input-----
Input is given from Standard Input in the following format:
A_{1, 1} A_{1, 2} A_{1, 3}
A_{2, 1} A_{2, 2} A_{2, 3}
A_{3, 1} A_{3, 2} A_{3, 3}
N
b_1
\vdots
b_N

-----Output-----
If we will have a bingo, print Yes; otherwise, print No.

-----Sample Input-----
84 97 66
79 89 11
61 59 7
7
89
7
87
79
24
84
30

-----Sample Output-----
Yes

We will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.

Difficulty: EASY

Solutions:
A = [list(map(int, input().split())) for i in range(3)]
n = int(input())
B = [int(input()) for i in range(n)]
C = [[0, 0, 0] for _ in range(3)]
for b in B:
	for i in range(3):
		for j in range(3):
			if A[i][j] == b:
				C[i][j] = 1
for i in range(3):
	if C[i][0] == 1 and C[i][1] == 1 and (C[i][2] == 1):
		print('Yes')
		return
	elif C[0][i] == 1 and C[1][i] == 1 and (C[2][i] == 1):
		print('Yes')
		return
if C[0][0] == 1 and C[1][1] == 1 and (C[2][2] == 1):
	print('Yes')
	return
elif C[0][2] == 1 and C[1][1] == 1 and (C[2][0] == 1):
	print('Yes')
	return
print('No')
return


import sys
a1 = [int(i) for i in input().split()]
a2 = [int(i) for i in input().split()]
a3 = [int(i) for i in input().split()]
for l in sys.stdin:
	if int(l) in a1:
		a1[a1.index(int(l))] = 0
	elif int(l) in a2:
		a2[a2.index(int(l))] = 0
	elif int(l) in a3:
		a3[a3.index(int(l))] = 0
m = sum(a1) * sum(a2) * sum(a3)
for i in range(3):
	m *= a1[i] + a2[i] + a3[i]
	m *= a1[i] + a2[1] + a3[2 - i]
print('Yes' if m == 0 else 'No')


import math

def i_input():
	return int(input())

def i_map():
	return map(int, input().split())

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

def i_row(N):
	return [int(input()) for _ in range(N)]

def i_row_list(N):
	return [list(map(int, input().split())) for _ in range(N)]
aaa = i_row_list(3)
n = i_input()
b = i_row(n)
ans = 'No'
for i in range(3):
	for j in range(3):
		if aaa[i][j] in b:
			aaa[i][j] = 0
xlos1 = 0
xlos2 = 0
for i in range(3):
	colm = 0
	rows = 0
	for j in range(3):
		colm += aaa[i][j]
		rows += aaa[j][i]
	xlos1 += aaa[i][i]
	xlos2 += aaa[2 - i][i]
	if colm == 0 or rows == 0:
		ans = 'Yes'
		break
if ans != 'Yes':
	if xlos1 == 0 or xlos2 == 0:
		ans = 'Yes'
print(ans)


import os, sys, re, math
A = []
for i in range(3):
	A += [int(n) for n in input().split()]
N = int(input())
for i in range(N):
	b = int(input())
	A = [0 if a == b else a for a in A]
bingo = 'No'
for x in range(3):
	if A[x * 3] == A[x * 3 + 1] == A[x * 3 + 2] == 0:
		bingo = 'Yes'
for y in range(3):
	if A[y] == A[y + 3] == A[y + 3 * 2] == 0:
		bingo = 'Yes'
if A[0] == A[4] == A[8] == 0 or A[2] == A[4] == A[6] == 0:
	bingo = 'Yes'
print(bingo)


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
lst = list(map(int, read().split()))
arr = lst[:9]
tf = [False] * 10
for i in lst[10:]:
	if i in arr:
		tf[arr.index(i)] = True
t = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
for i in t:
	a = True
	for j in i:
		if not tf[j]:
			a = False
	if a:
		print('Yes')
		quit()
else:
	print('No')


A = [[int(i) for i in input().split()] for j in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]
for i in range(N):
	for j in range(3):
		for k in range(3):
			if b[i] == A[j][k]:
				A[j][k] = 0
for i in range(3):
	if A[i][0] == A[i][1] and A[i][1] == A[i][2]:
		print('Yes')
		return
	if A[0][i] == A[1][i] and A[1][i] == A[2][i]:
		print('Yes')
		return
if A[0][0] == A[1][1] and A[1][1] == A[2][2]:
	print('Yes')
	return
if A[0][2] == A[1][1] and A[1][1] == A[2][0]:
	print('Yes')
	return
print('No')


A = []
for _ in range(3):
	A += map(int, input().split())
N = int(input())
for _ in range(N):
	b = int(input())
	if b in A:
		A[A.index(b)] = 0
for (i, j, k) in [(0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)]:
	if A[i] == A[j] == A[k]:
		print('Yes')
		break
else:
	print('No')


a = [list(map(int, input().split())) for _ in range(3)]
c = [a[0][0], a[0][1], a[0][2], a[1][0], a[1][1], a[1][2], a[2][0], a[2][1], a[2][2]]
n = int(input())
b = [int(input()) for _ in range(n)]
for i in range(n):
	if b[i] in c:
		c[c.index(b[i])] = 0
p = sum(c[:3]) * sum(c[3:6]) * sum(c[6:9]) * sum(c[::3]) * sum(c[1::3]) * sum(c[2::3]) * (c[0] + c[4] + c[8]) * (c[2] + c[4] + c[6])
if p == 0:
	print('Yes')
else:
	print('No')


Bingo_1 = list(map(int, input().split()))
Bingo_2 = list(map(int, input().split()))
Bingo_3 = list(map(int, input().split()))
number_table = []
number_count = int(input())
for i in range(number_count):
	number_table.append(int(input()))
for j in range(number_count):
	if number_table[j] == Bingo_1[0]:
		Bingo_1[0] = 0
	elif number_table[j] == Bingo_1[1]:
		Bingo_1[1] = 0
	elif number_table[j] == Bingo_1[2]:
		Bingo_1[2] = 0
	elif number_table[j] == Bingo_2[0]:
		Bingo_2[0] = 0
	elif number_table[j] == Bingo_2[1]:
		Bingo_2[1] = 0
	elif number_table[j] == Bingo_2[2]:
		Bingo_2[2] = 0
	elif number_table[j] == Bingo_3[0]:
		Bingo_3[0] = 0
	elif number_table[j] == Bingo_3[1]:
		Bingo_3[1] = 0
	elif number_table[j] == Bingo_3[2]:
		Bingo_3[2] = 0
if Bingo_1[0] == 0 and Bingo_1[1] == 0 and (Bingo_1[2] == 0):
	print('Yes')
elif Bingo_2[0] == 0 and Bingo_2[1] == 0 and (Bingo_2[2] == 0):
	print('Yes')
elif Bingo_3[0] == 0 and Bingo_3[1] == 0 and (Bingo_3[2] == 0):
	print('Yes')
elif Bingo_1[0] == 0 and Bingo_2[0] == 0 and (Bingo_3[0] == 0):
	print('Yes')
elif Bingo_1[1] == 0 and Bingo_2[1] == 0 and (Bingo_3[1] == 0):
	print('Yes')
elif Bingo_1[2] == 0 and Bingo_2[2] == 0 and (Bingo_3[2] == 0):
	print('Yes')
elif Bingo_1[0] == 0 and Bingo_2[1] == 0 and (Bingo_3[2] == 0):
	print('Yes')
elif Bingo_1[2] == 0 and Bingo_2[1] == 0 and (Bingo_3[0] == 0):
	print('Yes')
else:
	print('No')


A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]
ans = 'No'
for i in range(3):
	for j in range(3):
		if A[i][j] in B:
			A[i][j] = -1
for i in range(3):
	if sum(A[i]) == -3:
		ans = 'Yes'
	if A[0][i] + A[1][i] + A[2][i] == -3:
		ans = 'Yes'
if A[0][0] + A[1][1] + A[2][2] == -3:
	ans = 'Yes'
if A[0][2] + A[1][1] + A[2][0] == -3:
	ans = 'Yes'
print(ans)


A = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for i in range(3):
	for j in range(3):
		for k in range(n):
			if A[i][j] == b[k]:
				A[i][j] = -1
if A[0][0] == -1 and A[1][1] == -1 and (A[2][2] == -1):
	print('Yes')
	return
elif A[0][2] == -1 and A[1][1] == -1 and (A[2][0] == -1):
	print('Yes')
	return
for i in range(3):
	total = 0
	if A[i].count(-1) == 3:
		print('Yes')
		return
	for j in range(3):
		if A[j][i] == -1:
			total += 1
	if total == 3:
		print('Yes')
		return
print('No')


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
for i in range(3):
	if A[i][0] in B and A[i][1] in B and (A[i][2] in B) or (A[0][i] in B and A[1][i] in B and (A[2][i] in B)):
		print('Yes')
		exit()
if A[0][0] in B and A[1][1] in B and (A[2][2] in B) or (A[0][2] in B and A[1][1] in B and (A[2][0] in B)):
	print('Yes')
	exit()
print('No')


a = open(0).read().split()
print('YNeos'[all((t - set(map(a.index, a[10:])) for t in ({0, 1, 2}, {0, 3, 6}, {0, 4, 8}, {1, 4, 7}, {2, 4, 6}, {2, 5, 8}, {3, 4, 5}, {6, 7, 8})))::2])


a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
visited = [[False for i in range(3)] for j in range(3)]
for i in b:
	for j in range(3):
		for k in range(3):
			if i == a[j][k]:
				visited[j][k] = True
ans = 'No'
for i in visited:
	if i == [True, True, True]:
		ans = 'Yes'
for i in range(3):
	flag = True
	for j in range(3):
		if visited[j][i] == False:
			flag = False
			break
	if flag:
		ans = 'Yes'
if visited[0][0] and visited[1][1] and visited[2][2]:
	ans = 'Yes'
if visited[2][0] and visited[1][1] and visited[0][2]:
	ans = 'Yes'
print(ans)


def main():
	a = [list(map(int, input().split())) for _ in range(3)]
	n = int(input())
	b = [int(input()) for _ in range(n)]
	if a[0][0] in b and a[0][1] in b and (a[0][2] in b) or (a[1][0] in b and a[1][1] in b and (a[1][2] in b)) or (a[2][0] in b and a[2][1] in b and (a[2][2] in b)) or (a[0][0] in b and a[1][0] in b and (a[2][0] in b)) or (a[0][1] in b and a[1][1] in b and (a[2][1] in b)) or (a[0][2] in b and a[1][2] in b and (a[2][2] in b)) or (a[0][0] in b and a[1][1] in b and (a[2][2] in b)) or (a[0][2] in b and a[1][1] in b and (a[2][0] in b)):
		print('Yes')
	else:
		print('No')

def __starting_point():
	main()
__starting_point()


a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
flag = False
for i in range(3):
	if all((a[i][j] in b for j in range(3))):
		flag = True
	if all((a[j][i] in b for j in range(3))):
		flag = True
if all((a[i][i] in b for i in range(3))) or all((a[i][2 - i] in b for i in range(3))):
	flag = True
if flag:
	print('Yes')
else:
	print('No')


a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
for i in range(3):
	for j in range(3):
		if a[i][j] in b:
			a[i][j] = 0
tnp = 0
for i in range(3):
	if sum(a[i]) == 0:
		tnp += 1
for i in range(3):
	if a[0][i] + a[1][i] + a[2][i] == 0:
		tnp += 1
if a[0][0] + a[1][1] + a[2][2] == 0:
	tnp += 1
if a[0][2] + a[1][1] + a[2][0] == 0:
	tnp += 1
if tnp > 0:
	print('Yes')
else:
	print('No')


x = list(map(int, input().split()))
y = list(map(int, input().split()))
z = list(map(int, input().split()))
A = [x, y, z]
X = [A[0][0], A[1][0], A[2][0]]
Y = [A[0][1], A[1][1], A[2][1]]
Z = [A[0][2], A[1][2], A[2][2]]
P = [A[0][0], A[1][1], A[2][2]]
Q = [A[0][2], A[1][1], A[2][0]]
B = []
for i in range(int(input())):
	B.append(int(input()))
C = [x, y, z, X, Y, Z, P, Q]
for c in C:
	if set(c) <= set(B):
		print('Yes')
		break
else:
	print('No')


arr = []
ans = []
for i in range(3):
	arr.extend(list(map(int, input().split())))
N = int(input())
for j in range(N):
	num = int(input())
	if num in arr:
		ans.append(arr.index(num))
ans = set(ans)
if set([0, 1, 2]) <= ans or set([3, 4, 5]) <= ans or set([6, 7, 8]) <= ans or (set([0, 3, 6]) <= ans) or (set([1, 4, 7]) <= ans) or (set([2, 5, 8]) <= ans) or (set([0, 4, 8]) <= ans) or (set([2, 4, 6]) <= ans):
	print('Yes')
else:
	print('No')


a = []
sheet = [0] * 9
for _ in range(3):
	a += list(map(int, input().split()))
n = int(input())
for _ in range(n):
	b = int(input())
	if b in a:
		c = a.index(b)
		sheet[c] = 1
bingo = [[0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 4, 8], [2, 4, 6]]
flg = 0
for bb in bingo:
	if sheet[bb[0]] == 1:
		if sheet[bb[1]] == 1:
			if sheet[bb[2]] == 1:
				flg = 1
if flg == 1:
	print('Yes')
else:
	print('No')


A = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
cdl = 0
cdr = 0
for i in range(3):
	cr = 0
	cc = 0
	for j in range(3):
		if A[i][j] in b:
			cr += 1
		if A[j][i] in b:
			cc += 1
		if i == j and A[i][j] in b:
			cdl += 1
		if i + j == 2 and A[i][j] in b:
			cdr += 1
	if cr == 3 or cc == 3 or cdl == 3 or (cdr == 3):
		print('Yes')
		return
print('No')


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
bn = [int(input()) for _ in range(N)]
ans = False
for ver in zip(*A):
	if all((item in bn for item in ver)):
		ans = True
for wide in A:
	if all((item in bn for item in wide)):
		ans = True
if all((A[i][i] in bn for i in range(3))):
	ans = True
if all((A[i][3 - i - 1] in bn for i in range(3))):
	ans = True
if ans == True:
	print('Yes')
else:
	print('No')


(*inputs,) = map(int, open(0).read().split())
A = inputs[:9]
B = inputs[9:]
C = [0] * 9
for b in B:
	if b in A:
		C[A.index(b)] = 1
if any([all(C[:3]), all(C[3:6]), all(C[6:]), all(C[::3]), all(C[1::3]), all(C[2::3]), all([C[0], C[4], C[8]]), all([C[2], C[4], C[6]])]):
	print('Yes')
else:
	print('No')


a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for i in range(3):
	for j in range(3):
		if a[i][j] in b:
			a[i][j] = 'o'
for i in range(3):
	if a[i][0] == a[i][1] == a[i][2]:
		print('Yes')
		return
	elif a[0][i] == a[1][i] == a[2][i]:
		print('Yes')
		return
	elif a[0][0] == a[1][1] == a[2][2]:
		print('Yes')
		return
	elif a[0][2] == a[1][1] == a[2][0]:
		print('Yes')
		return
	elif i == 2:
		print('No')


ary = [list(map(int, input().split())) for p in range(3)]
for i in range(int(input())):
	data = int(input())
	for j in range(3):
		for k in range(3):
			if ary[j][k] == data:
				ary[j][k] = 0
ans = 'No'
for i in range(3):
	if ary[i][0] == ary[i][1] == ary[i][2] == 0 or ary[0][i] == ary[1][i] == ary[2][i] == 0:
		ans = 'Yes'
if ary[0][0] == ary[1][1] == ary[2][2] == 0 or ary[2][0] == ary[1][1] == ary[0][2] == 0:
	ans = 'Yes'
print(ans)


l = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = list((int(input()) for _ in range(n)))
for i in range(3):
	for j in range(3):
		for k in range(n):
			if l[i][j] == b[k]:
				l[i][j] = 0
for i in range(3):
	if l[i][0] + l[i][1] + l[i][2] == 0:
		print('Yes')
		return
	if l[0][i] + l[1][i] + l[2][i] == 0:
		print('Yes')
		return
	if l[0][0] + l[1][1] + l[2][2] == 0:
		print('Yes')
		return
	if l[0][2] + l[1][1] + l[2][0] == 0:
		print('Yes')
		return
print('No')


def main():
	A = [list(map(int, input().split())) for _ in range(3)]
	n = int(input())
	for _ in range(n):
		b = int(input())
		for i in range(3):
			for j in range(3):
				if A[i][j] == b:
					A[i][j] = 0
	ans = 'No'
	for i in range(3):
		if any(A[i]) == 0:
			ans = 'Yes'
	for i in range(3):
		if any([A[0][i], A[1][i], A[2][i]]) == 0:
			ans = 'Yes'
	if any([A[0][0], A[1][1], A[2][2]]) == 0:
		ans = 'Yes'
	if any([A[0][2], A[1][1], A[2][0]]) == 0:
		ans = 'Yes'
	print(ans)

def __starting_point():
	main()
__starting_point()


a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
lines = [set(x) for x in a] + [set(x) for x in zip(*a)] + [set([a[0][0], a[1][1], a[2][2]]), set([a[0][2], a[1][1], a[2][0]])]
bs = set(b)
if any((line.issubset(bs) for line in lines)):
	print('Yes')
else:
	print('No')


def func(a, i):
	return {a[0]: i, a[1]: i + 1, a[2]: i + 2}
A = {}
for i in range(3):
	A.update(func(input().split(), 3 * i))
N = int(input())
b = [A.get(input(), -1) for _ in range(N)]
bingo = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
for i in bingo:
	if set(i) <= set(b):
		print('Yes')
		break
else:
	print('No')


al = list(map(int, input().split())) + list(map(int, input().split())) + list(map(int, input().split()))
n = int(input())
bl = [int(input()) for _ in [0] * n]
for i in bl:
	for j in range(9):
		if al[j] == i:
			al[j] = 0
nobingo = (al[0] + al[1] + al[2]) * (al[3] + al[4] + al[5]) * (al[6] + al[7] + al[8]) * (al[0] + al[3] + al[6]) * (al[1] + al[4] + al[7]) * (al[2] + al[5] + al[8]) * (al[0] + al[4] + al[8]) * (al[2] + al[4] + al[6])
if nobingo:
	print('No')
else:
	print('Yes')


import sys
a = []
for i in range(3):
	a = a + [int(x) for x in input().split()]
n = int(input())
for i in range(n):
	b = int(input())
	for j in range(9):
		if a[j] == b:
			a[j] = -1
for (i, k, j) in [[1, 2, 3], [4, 5, 6], [7, 8, 9], [1, 4, 7], [2, 5, 8], [3, 6, 9], [1, 5, 9], [3, 5, 7]]:
	if a[i - 1] == a[j - 1] == a[k - 1] == -1:
		print('Yes')
		sys.exit()
print('No')


bingo = []
kiroku = [[0, 0, 0] for i in range(3)]
for i in range(3):
	(a, b, c) = map(int, input().split())
	bingo.append([a, b, c])
n = int(input())
for j in range(n):
	num = int(input())
	for k in range(3):
		for l in range(3):
			if bingo[k][l] == num:
				kiroku[k][l] = 1
ans = 0
for i in range(3):
	if kiroku[i][0] == kiroku[i][1] == kiroku[i][2] == 1 or kiroku[0][i] == kiroku[1][i] == kiroku[2][i] == 1:
		ans = 1
		break
if kiroku[0][0] == kiroku[1][1] == kiroku[2][2] == 1 or kiroku[0][2] == kiroku[1][1] == kiroku[2][0] == 1:
	ans = 1
if ans == 1:
	print('Yes')
else:
	print('No')


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
a = inl()
b = inl()
c = inl()
n = ini()
bingo = []
for _ in range(n):
	bingo.append(ini())
ct = [0] * 9
for i in bingo:
	if i in a:
		ct[a.index(i)] = 1
	if i in b:
		ct[b.index(i) + 3] = 1
	if i in c:
		ct[c.index(i) + 6] = 1
if sum(ct[:3]) == 3 or sum(ct[3:6]) == 3 or sum(ct[6:9]) == 3:
	print('Yes')
elif ct[0] + ct[4] + ct[8] == 3 or ct[2] + ct[4] + ct[6] == 3:
	print('Yes')
elif ct[0] + ct[3] + ct[6] == 3 or ct[1] + ct[4] + ct[7] == 3 or ct[2] + ct[5] + ct[8] == 3:
	print('Yes')
else:
	print('No')


(a, b, c) = list(map(int, input().split()))
(e, f, g) = list(map(int, input().split()))
(h, i, j) = list(map(int, input().split()))
bingo_list = [[a, b, c], [e, f, g], [h, i, j], [a, e, h], [b, f, i], [c, g, j], [a, f, j], [c, f, h]]
n = int(input())
n_list = [int(input()) for _ in range(n)]
count = 0
ans = 'No'
for i in bingo_list:
	for j in n_list:
		if j in i:
			count += 1
		if count == 3:
			ans = 'Yes'
			break
	if ans == 'Yes':
		break
	count = 0
print(ans)


a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
for i in range(n):
	b = int(input())
	for j in range(3):
		for k in range(3):
			if a[j][k] == b:
				a[j][k] = 0
ans = 'No'
for i in range(3):
	if a[i][0] == a[i][1] == a[i][2] == 0:
		ans = 'Yes'
	if a[0][i] == a[1][i] == a[2][i] == 0:
		ans = 'Yes'
if a[0][0] == a[1][1] == a[2][2] == 0:
	ans = 'Yes'
if a[2][0] == a[1][1] == a[0][2] == 0:
	ans = 'Yes'
print(ans)


A = []
for _ in range(3):
	(a1, a2, a3) = map(int, input().split())
	A += [(a1, a2, a3)]
n = int(input())
B = []
for _ in range(n):
	B += [int(input())]
for i in range(3):
	A += [(A[0][i], A[1][i], A[2][i])]
A += [(A[0][0], A[1][1], A[2][2])]
A += [(A[0][2], A[1][1], A[2][0])]
ans = 'No'
for x in A:
	_ans = [1 for _x in x if _x in B]
	if len(_ans) == 3:
		ans = 'Yes'
		break
print(ans)


p1 = list(map(int, input().split()))
p2 = list(map(int, input().split()))
p3 = list(map(int, input().split()))
p = p1 + p2 + p3
n = int(input())
for _ in range(n):
	b = int(input())
	if b in p:
		p[p.index(b)] = 0
if p[0] + p[1] + p[2] == 0 or p[3] + p[4] + p[5] == 0 or p[6] + p[7] + p[8] == 0 or (p[0] + p[3] + p[6] == 0) or (p[1] + p[4] + p[7] == 0) or (p[2] + p[5] + p[8] == 0) or (p[0] + p[4] + p[8] == 0) or (p[2] + p[4] + p[6] == 0):
	print('Yes')
else:
	print('No')


import sys
input = sys.stdin.readline

def bingo_check(card):
	for low in card:
		if sum(low) == 0:
			print('Yes')
			return
	column1 = 0
	column2 = 0
	column3 = 0
	for low in card:
		column1 += low[0]
		column2 += low[1]
		column3 += low[2]
	if column1 == 0 or column2 == 0 or column3 == 0:
		print('Yes')
		return
	diagonal1 = card[0][0] + card[1][1] + card[2][2]
	diagonal2 = card[0][2] + card[1][1] + card[2][0]
	if diagonal1 == 0 or diagonal2 == 0:
		print('Yes')
		return
	print('No')

def main():
	bingo = []
	use_card = []
	bingo = [list(map(int, input().split())) for _ in range(3)]
	use_card = bingo
	n = int(input())
	for idx in range(n):
		number = int(input())
		for i in range(3):
			for j in range(3):
				if number == use_card[i][j]:
					use_card[i][j] = 0
				else:
					continue
	bingo_check(use_card)

def __starting_point():
	main()
__starting_point()


A = [0 for i in range(9)]
for i in range(3):
	(A[3 * i], A[3 * i + 1], A[3 * i + 2]) = map(int, input().split())
N = int(input())
b = [0 for i in range(N)]
for i in range(N):
	b[i] = int(input())
for i in range(9):
	for j in range(N):
		if A[i] == b[j]:
			A[i] = 1
flag = 0
for i in [0, 3, 6]:
	if A[i] == A[i + 1] and A[i + 1] == A[i + 2]:
		flag += 1
for j in range(3):
	if A[j] == A[j + 3] and A[j + 3] == A[j + 6]:
		flag += 1
if A[0] == A[4] and A[4] == A[8] or (A[2] == A[4] and A[4] == A[6]):
	flag += 1
if flag >= 1:
	print('Yes')
else:
	print('No')


a = []
for _ in range(3):
	a += list(map(int, input().split()))
n = int(input())
for _ in range(n):
	b = int(input())
	if b in a:
		i = a.index(b)
		a[i] = 0
if sum(a[0:3]) == 0 or sum(a[3:6]) == 0 or sum(a[6:]) == 0 or (sum(a[0::3]) == 0) or (sum(a[1::3]) == 0) or (sum(a[2::3]) == 0) or (sum(a[0::4]) == 0) or (sum(a[2:7:2]) == 0):
	print('Yes')
else:
	print('No')


import itertools
A = [list(map(int, input().split())) for i in range(3)]
A = list(itertools.chain.from_iterable(A))
N = int(input())
for _ in range(N):
	b = int(input())
	try:
		A[A.index(b)] = 'X'
	except:
		continue
answer = 'No'
for bingo in [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 4, 8], [2, 4, 6], [0, 3, 6], [1, 4, 7], [2, 5, 8]]:
	if A[bingo[0]] == 'X' and A[bingo[1]] == 'X' and (A[bingo[2]] == 'X'):
		answer = 'Yes'
print(answer)


sheet = []
for i in range(3):
	sheet.append([int(x) for x in input().split()])
bingo = [[False] * 3 for _ in range(3)]
N = int(input())
for i in range(N):
	a = int(input())
	for x in range(3):
		for y in range(3):
			if sheet[x][y] == a:
				bingo[x][y] = True
for i in range(3):
	if bingo[i][0] and bingo[i][1] and bingo[i][2]:
		print('Yes')
		return
	if bingo[0][i] and bingo[1][i] and bingo[2][i]:
		print('Yes')
		return
if bingo[0][0] and bingo[1][1] and bingo[2][2]:
	print('Yes')
	return
if bingo[2][0] and bingo[1][1] and bingo[0][2]:
	print('Yes')
	return
print('No')


A = []
for _ in range(3):
	A += [list(map(int, input().split()))]
import copy
B = copy.deepcopy(A)
for i in range(3):
	B += [[A[0][i], A[1][i], A[2][i]]]
B += [[A[0][0], A[1][1], A[2][2]]]
B += [[A[0][2], A[1][1], A[2][0]]]
B = [set(b) for b in B]
N = int(input())
bs = []
for _ in range(N):
	bs += [int(input())]
bs = set(bs)
flag = 'No'
for b in B:
	if b.issubset(bs):
		flag = 'Yes'
print(flag)


A = [list(map(int, input().split(' '))) for i in range(3)]
N = int(input())
B = set([int(input()) for i in range(N)])
X = []
X += [set(A[i]) for i in range(3)]
X += [set([A[j][i] for j in range(3)]) for i in range(3)]
X += [set([A[0][2], A[1][1], A[2][0]]), set([A[2][2], A[1][1], A[0][0]])]
for x in X:
	if x <= B:
		print('Yes')
		break
else:
	print('No')


(A11, A12, A13) = list(map(int, input().split()))
(A21, A22, A23) = list(map(int, input().split()))
(A31, A32, A33) = list(map(int, input().split()))
A = [[A11, A12, A13], [A21, A22, A23], [A31, A32, A33]]
N = int(input())
b = [int(input()) for _ in range(N)]
for i in range(3):
	for j in range(3):
		if A[i][j] in b:
			A[i][j] = 'YES'
if A[1][1] == 'YES':
	if A[1][0] == A[1][2] == 'YES' or A[0][1] == A[2][1] == 'YES' or A[0][0] == A[2][2] == 'YES' or (A[0][2] == A[2][0] == 'YES'):
		print('Yes')
	else:
		print('No')
elif A[0][0] == A[0][1] == A[0][2] == 'YES' or A[0][0] == A[1][0] == A[2][0] == 'YES' or A[2][0] == A[2][1] == A[2][2] == 'YES' or (A[0][2] == A[1][2] == A[2][2] == 'YES'):
	print('Yes')
else:
	print('No')


(A11, A12, A13) = map(int, input().split())
(A21, A22, A23) = map(int, input().split())
(A31, A32, A33) = map(int, input().split())
N = int(input())
b = [int(input()) for i in range(N)]
Bingo = [[A11, A12, A13], [A21, A22, A23], [A31, A32, A33], [A11, A21, A31], [A12, A22, A32], [A13, A23, A33], [A11, A22, A33], [A13, A22, A31]]
for j in Bingo:
	if set(j).issubset(b):
		print('Yes')
		exit()
print('No')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
n = int(input())
l = []
for i in range(n):
	li = int(input())
	l.append(li)
for x in [a, b, c, [a[0], b[0], c[0]], [a[1], b[1], c[1]], [a[2], b[2], c[2]], [a[0], b[1], c[2]], [a[2], b[1], c[0]]]:
	flag = True
	for xi in x:
		if xi not in l:
			flag = False
			break
	if flag:
		print('Yes')
		exit()
print('No')


A = []
P = ['o'] * 9
for i in range(3):
	a = [int(i) for i in input().split()]
	for j in range(3):
		A.append(a[j])
N = int(input())
for i in range(N):
	b = int(input())
	for j in range(9):
		if A[j] == b:
			P[j] = 'x'
t = 0
for i in range(3):
	if P[i] == P[i + 3] == P[i + 6] == 'x' or P[3 * i] == P[3 * i + 1] == P[3 * i + 2] == 'x':
		t += 1
		break
if P[0] == P[4] == P[8] == 'x' or P[2] == P[4] == P[6] == 'x':
	t += 1
if t == 0:
	print('No')
else:
	print('Yes')


S = '012 345 678 036 147 258 048 246 '
A = sum([input().split() for i in range(4)], [])
for b in [input() for i in range(int(A[9]))]:
	if b in A:
		S = S.replace(str(A.index(b)), '')
print('NYoe s'['  ' in S::2])


import sys
a = []
for i in range(3):
	a += list(map(int, input().split()))
n = int(input())
b = []
for i in range(n):
	b.append(int(input()))
x = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [1, 4, 7], [2, 5, 8], [3, 6, 9], [1, 5, 9], [3, 5, 7]]
for i in range(8):
	if a[x[i][0] - 1] in b and a[x[i][1] - 1] in b and (a[x[i][2] - 1] in b):
		print('Yes')
		sys.exit()
print('No')


def Judge(a):
	col = []
	diag1 = 0
	diag2 = 0
	for i in range(3):
		if a[i].count(0) == 3:
			return 1
			break
		if a[i][0] == 0:
			col.append(0)
		if a[i][1] == 0:
			col.append(1)
		if a[i][2] == 0:
			col.append(2)
		if a[i][i] == 0:
			diag1 += 1
		if a[i][-(i + 1)] == 0:
			diag2 += 1
	if diag1 == 3 or diag2 == 3:
		return 1
	if col.count(0) == 3 or col.count(1) == 3 or col.count(2) == 3:
		return 1
	return 0
a = []
for i in range(3):
	a.append(list(map(int, input().split())))
n = int(input())
for i in range(n):
	b = int(input())
	for j in range(3):
		for k in range(3):
			if b == a[j][k]:
				a[j][k] = 0
judge = Judge(a)
if judge == 1:
	print('Yes')
else:
	print('No')


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]
f = 0
for v in b:
	for i in range(9):
		if A[i // 3][i % 3] == v:
			f |= 1 << i
ans = [v for v in [7, 56, 73, 84, 146, 273, 292, 448] if f & v == v]
print('Yes' if ans else 'No')


A = [[int(x) for x in input().split()] for _ in range(3)]
s = [[0 for i in range(3)] for j in range(3)]
for i in range(int(input())):
	n = int(input())
	for y in range(3):
		for x in range(3):
			if A[y][x] == n:
				s[y][x] = 1
a = []
for i in range(3):
	a.append(s[0][i] * s[1][i] * s[2][i])
	a.append(s[i][0] * s[i][1] * s[i][2])
a.append(s[0][0] * s[1][1] * s[2][2])
a.append(s[0][2] * s[1][1] * s[2][0])
print('Yes' if 1 in a else 'No')


import numpy as np
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
for i in range(n):
	b = int(input())
	for j in range(3):
		if b in a[j]:
			idx = a[j].index(b)
			a[j][idx] = 0
np_a = np.array(a)
np_t = np_a.T
d = 0
u = 0
for i in range(3):
	r = np_a[i]
	c = np_t[i]
	d += r[i]
	u += r[2 - i]
	if r.sum() and c.sum():
		continue
	print('Yes')
	return
if d and u:
	print('No')
else:
	print('Yes')


(p, r) = (input, range)
A = sum([list(map(int, p().split())) for _ in r(3)], [])
N = int(p())
b = [int(p()) for _ in r(N)]
print('Yes' if [v for v in [7, 56, 73, 84, 146, 273, 292, 448] if sum((1 << i for i in r(9) if A[i] in b)) & v == v] else 'No')


(a1, a2, a3, _, *b) = [i.split() for i in open(0)]
bingo = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [2, 5, 8], [0, 3, 6], [1, 4, 7], [0, 4, 8], [2, 4, 6]]
s = ['' if i in sum(b, []) else i for i in a1 + a2 + a3]
for (i, j, k) in bingo:
	if {s[i], s[j], s[k]} == {''}:
		print('Yes')
		exit()
print('No')


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]
c = [[0] * 3 for _ in range(3)]
for x in b:
	for i in range(3):
		for j in range(3):
			if A[i][j] == x:
				c[i][j] = 1
if c[0] == [1, 1, 1] or c[1] == [1, 1, 1] or c[2] == [1, 1, 1]:
	print('Yes')
elif [c[0][0], c[1][0], c[2][0]] == [1, 1, 1] or [c[0][1], c[1][1], c[2][1]] == [1, 1, 1] or [c[0][2], c[1][2], c[2][2]] == [1, 1, 1]:
	print('Yes')
elif [c[0][0], c[1][1], c[2][2]] == [1, 1, 1] or [c[2][0], c[1][1], c[0][2]] == [1, 1, 1]:
	print('Yes')
else:
	print('No')


def is_b(l):
	return all([a[i][j] in b for (i, j) in l])
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
t = [[(i, j) for j in range(3)] for i in range(3)]
t += [[(j, i) for j in range(3)] for i in range(3)]
t += [[(i, i) for i in range(3)]] + [[(2 - i, i) for i in range(3)]]
print('Yes' if any([is_b(ti) for ti in t]) else 'No')


A = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
B = [int(input()) for _ in range(n)]
for i in range(3):
	for j in range(3):
		if A[i][j] in B:
			A[i][j] = -1
for i in range(3):
	(ans1, ans2) = (0, 0)
	for j in range(3):
		if A[i][j] == -1:
			ans1 += 1
		if A[j][i] == -1:
			ans2 += 1
	if ans1 == 3 or ans2 == 3:
		print('Yes')
		return
if A[0][0] == -1 and A[1][1] == -1 and (A[2][2] == -1) or (A[0][2] == -1 and A[1][1] == -1 and (A[2][0] == -1)):
	print('Yes')
else:
	print('No')


f = lambda : list(map(int, input().split()))
l = f() + f() + f()
n = int(input())
s = set()
for i in range(n):
	b = int(input())
	if b in l:
		s |= {l.index(b)}
print(['No', 'Yes'][any((t <= s for t in [{0, 1, 2}, {0, 3, 6}, {0, 4, 8}, {1, 4, 7}, {2, 4, 6}, {2, 5, 8}, {3, 4, 5}, {6, 7, 8}]))])


Flag = False
A = []
for i in range(3):
	A.extend(list(map(int, input().split())))
N = int(input())
B = [int(input()) for i in range(N)]
for i in B:
	if i in A:
		A[A.index(i)] = 0
for i in range(3):
	if A[i] + A[i + 3] + A[i + 6] == 0:
		Flag = True
	if A[3 * i] + A[3 * i + 1] + A[3 * i + 2] == 0:
		Flag = True
if A[0] + A[4] + A[8] == 0 or A[2] + A[4] + A[6] == 0:
	Flag = True
if Flag:
	print('Yes')
else:
	print('No')


a = input()
a = a.split()
b = input()
b = b.split()
c = input()
c = c.split()
d = [a[0], b[0], c[0]]
e = [a[1], b[1], c[1]]
f = [a[2], b[2], c[2]]
g = [a[0], b[1], c[2]]
h = [a[2], b[1], c[0]]
n = int(input())
for i in range(n):
	j = int(input())
	for k in range(3):
		if int(a[k]) == j:
			a.pop(k)
			a.insert(k, 0)
		if int(b[k]) == j:
			b.pop(k)
			b.insert(k, 0)
		if int(c[k]) == j:
			c.pop(k)
			c.insert(k, 0)
		if int(d[k]) == j:
			d.pop(k)
			d.insert(k, 0)
		if int(e[k]) == j:
			e.pop(k)
			e.insert(k, 0)
		if int(f[k]) == j:
			f.pop(k)
			f.insert(k, 0)
		if int(g[k]) == j:
			g.pop(k)
			g.insert(k, 0)
		if int(h[k]) == j:
			h.pop(k)
			h.insert(k, 0)
if a == [0, 0, 0] or b == [0, 0, 0] or c == [0, 0, 0] or (d == [0, 0, 0]) or (e == [0, 0, 0]) or (f == [0, 0, 0]) or (g == [0, 0, 0]) or (h == [0, 0, 0]):
	print('Yes')
else:
	print('No')


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())
s = set()
for _ in range(N):
	b = int(input())
	if b in A:
		s |= {A.index(b)}
bingo = [{0, 1, 2}, {0, 3, 6}, {0, 4, 8}, {1, 4, 7}, {2, 4, 6}, {2, 5, 8}, {3, 4, 5}, {6, 7, 8}]
print(['No', 'Yes'][any((b <= s for b in bingo))])


A = []
for i in range(3):
	A += list(map(int, input().split()))
called = [False] * 9
bingo = ((0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6))
N = int(input())
for i in range(N):
	target = int(input())
	if target in A:
		called[A.index(target)] = True
for (a, b, c) in bingo:
	if called[a] and called[b] and called[c]:
		print('Yes')
		break
else:
	print('No')


a = [0] * 9
(a[0], a[1], a[2]) = map(int, input().split())
(a[3], a[4], a[5]) = map(int, input().split())
(a[6], a[7], a[8]) = map(int, input().split())
N = int(input())
B = []
for i in range(N):
	B.append(int(input()))
S = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
ans = 'No'
for lis in S:
	n = 0
	if ans == 'Yes':
		break
	for i in range(3):
		if a[lis[i]] in B:
			n += 1
		if n == 3:
			ans = 'Yes'
print(ans)


A = []
B = []
for i in range(3):
	A.extend(list(map(int, input().split())))
n = int(input())
for i in range(n):
	b = int(input())
	try:
		A[A.index(b)] = 0
	except:
		continue
if A[0] == A[1] == A[2] or A[3] == A[4] == A[5] or A[6] == A[7] == A[8] or (A[0] == A[3] == A[6]) or (A[1] == A[4] == A[7]) or (A[2] == A[5] == A[8]) or (A[0] == A[4] == A[8]) or (A[2] == A[4] == A[6]):
	print('Yes')
else:
	print('No')


l = []
for i in range(3):
	a = list(map(int, input().split()))
	for j in a:
		l.append(j)
n = int(input())
l2 = []
for i in range(n):
	l2.append(int(input()))
for i in range(len(l)):
	if l[i] in l2:
		l[i] = 0
y1 = l[0] + l[1] + l[2]
y2 = l[3] + l[4] + l[5]
y3 = l[6] + l[7] + l[8]
t1 = l[0] + l[3] + l[6]
t2 = l[1] + l[4] + l[7]
t3 = l[2] + l[5] + l[8]
n1 = l[0] + l[4] + l[8]
n2 = l[2] + l[4] + l[6]
if y1 * y2 * y3 * t1 * t2 * t3 * n1 * n2 == 0:
	print('Yes')
else:
	print('No')


def resolve():
	a = []
	bingo = [(0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 4, 8), (2, 4, 6)]
	for _ in range(3):
		a += list(map(int, input().split()))
	for i in range(int(input())):
		r = int(input())
		if r in a:
			a[a.index(r)] = 0
	ans = 'No'
	for i in bingo:
		if a[i[0]] == 0 and a[i[1]] == 0 and (a[i[2]] == 0):
			ans = 'Yes'
	print(ans)
resolve()


a = []
for _ in range(3):
	a = a + [int(i) for i in input().split()]
n = int(input())
a_bingo = [0] * 3 * 3
pos = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
for _ in range(n):
	b = int(input())
	if b in a:
		a_bingo[a.index(b)] = 1
for po in pos:
	if a_bingo[po[0]] == a_bingo[po[1]] == a_bingo[po[2]] == 1:
		print('Yes')
		exit()
print('No')


S = '012 345 678 036 147 258 048 246 '
A = sum([input().split() for i in range(3)], [])
for b in [input() for i in range(int(input()))]:
	if b in A:
		S = S.replace(str(A.index(b)), '')
print(['No', 'Yes'][S.find('  ') > -1])


mat = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for i in range(3):
	(x, y, z) = map(int, input().split())
	mat[i][0] = x
	mat[i][1] = y
	mat[i][2] = z
n = int(input())
for i in range(n):
	x = int(input())
	for j in range(3):
		for k in range(3):
			if mat[j][k] == x:
				mat[j][k] = -1
				break
if mat[0][0] == -1 and mat[0][1] == -1 and (mat[0][2] == -1):
	print('Yes')
	return
elif mat[1][0] == -1 and mat[1][1] == -1 and (mat[1][2] == -1):
	print('Yes')
	return
elif mat[2][0] == -1 and mat[2][1] == -1 and (mat[2][2] == -1):
	print('Yes')
	return
elif mat[0][0] == -1 and mat[1][0] == -1 and (mat[2][0] == -1):
	print('Yes')
	return
elif mat[0][1] == -1 and mat[1][1] == -1 and (mat[2][1] == -1):
	print('Yes')
	return
elif mat[0][2] == -1 and mat[1][2] == -1 and (mat[2][2] == -1):
	print('Yes')
	return
elif mat[0][0] == -1 and mat[1][1] == -1 and (mat[2][2] == -1):
	print('Yes')
	return
elif mat[2][0] == -1 and mat[1][1] == -1 and (mat[0][2] == -1):
	print('Yes')
	return
else:
	print('No')


a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
n = int(input())
for i in range(n):
	b = int(input())
	if b in a1:
		a1[a1.index(b)] = 0
	if b in a2:
		a2[a2.index(b)] = 0
	if b in a3:
		a3[a3.index(b)] = 0
if sum(a1) != 0 and sum(a2) != 0 and (sum(a3) != 0) and (a1[0] + a2[0] + a3[0] != 0) and (a1[1] + a2[1] + a3[1] != 0) and (a1[2] + a2[2] + a3[2] != 0) and (a1[0] + a2[1] + a3[2] != 0) and (a1[2] + a2[1] + a3[0] != 0):
	print('No')
else:
	print('Yes')


al = [list(map(int, input().split())) for i in range(3)]
al = sum(al, [])
n = int(input())
bl = [int(input()) for i in range(n)]
check = [0 for i in range(9)]
for b in bl:
	if b in al:
		check[al.index(b)] = 1
if [1, 1, 1] in [check[:3], check[3:6], check[6:], check[0:7:3], check[1:8:3], check[2:9:3], check[0:9:4], check[2:8:2]]:
	print('Yes')
else:
	print('No')


a = list(map(int, ' '.join([input() for i in range(3)]).split()))
n = int(input())
b = [int(input()) for i in range(n)]
for i in b:
	if i in a:
		p = a.index(i)
		a[p] = '*'
p = 0
for i in range(3):
	if a[i] == a[i + 3] == a[i + 6] == '*':
		p += 1
for i in range(3):
	if a[3 * i] == a[3 * i + 1] == a[3 * i + 2] == '*':
		p += 1
if a[0] == a[4] == a[8] == '*' or a[2] == a[4] == a[6] == '*':
	p += 1
print('Yes') if p > 0 else print('No')


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]
flag = 0
for i in range(3):
	if A[0][i] in b and A[1][i] in b and (A[2][i] in b):
		flag = 1
	elif A[i][0] in b and A[i][1] in b and (A[i][2] in b):
		flag = 1
if A[0][0] in b and A[1][1] in b and (A[2][2] in b):
	flag = 1
elif A[0][2] in b and A[1][1] in b and (A[2][0] in b):
	flag = 1
print('Yes' if flag == 1 else 'No')


(a, b, c) = [int(x) for x in input().split()]
(d, e, f) = [int(x) for x in input().split()]
(g, h, i) = [int(x) for x in input().split()]
n = int(input())
S = {int(input()) for x in range(n)}

def q(x, y, z):
	return x in S and y in S and (z in S)
print('Yes' if q(a, b, c) or q(d, e, f) or q(g, h, i) or q(a, d, g) or q(b, e, h) or q(c, f, i) or q(a, e, i) or q(g, e, c) else 'No')


a = [list(map(int, input().split())) for _ in range(3)]
a = a[0] + a[1] + a[2]
c = [a[0:3], a[3:6], a[6:9], a[::3], a[1::3], a[2::3], [a[0], a[4], a[8]], [a[2], a[4], a[6]]]
n = int(input())
b = [int(input()) for _ in range(n)]
same = set(a) & set(b)
for d in c:
	cnt = 0
	for n in same:
		if n in d:
			cnt += 1
	if cnt == 3:
		print('Yes')
		exit()
else:
	print('No')


A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]
x = [[0] * 3 for i in range(3)]
for b in B:
	for (i, l) in enumerate(A):
		for (j, a) in enumerate(l):
			if a == b:
				x[i][j] = 1
print('Yes' if sum([all(l) for l in x] + [all(l) for l in zip(*x)] + [all([x[i][i] for i in range(3)]), all([x[i][2 - i] for i in range(3)])]) else 'No')


lst = [[int(i) for i in input().split()] for j in range(3)]
n = int(input())
for _ in range(n):
	x = int(input())
	for d in lst:
		if d[0] == x:
			d[0] = -1
		elif d[1] == x:
			d[1] = -1
		elif d[2] == x:
			d[2] = -1
for d in lst:
	if d[0] == d[1] == d[2] == -1:
		print('Yes')
		return
for i in range(3):
	if lst[0][i] == lst[1][i] == lst[2][i] == -1:
		print('Yes')
		return
for i in range(3):
	if lst[i][0] == lst[i][1] == lst[i][2] == -1:
		print('Yes')
		return
if lst[0][0] == lst[1][1] == lst[2][2] == -1:
	print('Yes')
	return
if lst[0][2] == lst[1][1] == lst[2][0] == -1:
	print('Yes')
	return
print('No')


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())
ans = [0] * 9
a = 'No'
for i in range(N):
	b = int(input())
	if b in A:
		ans[A.index(b)] = 1
cheack = [ans[0:3], ans[3:6], ans[6:9], ans[0::3], ans[1::3], ans[2::3], ans[0::4], ans[2:7:2]]
for C in cheack:
	if sum(C) == 3:
		a = 'Yes'
		break
print(a)


B1 = list(map(int, input().split()))
B2 = list(map(int, input().split()))
B3 = list(map(int, input().split()))
B = B1 + B2 + B3
N = int(input())
for n in range(N):
	num = int(input())
	B = [0 if i == num else i for i in B]
	if (B[0] + B[1] + B[2]) * (B[3] + B[4] + B[5]) * (B[6] + B[7] + B[8]) * (B[0] + B[3] + B[6]) * (B[1] + B[4] + B[7]) * (B[2] + B[5] + B[8]) * (B[0] + B[4] + B[8]) * (B[2] + B[4] + B[6]) == 0:
		print('Yes')
		exit()
print('No')


rows = []
for _ in range(3):
	A = list(map(int, input().split()))
	rows.append(A)
N = int(input())
for _ in range(N):
	b = int(input())
	for i in range(3):
		for j in range(3):
			if rows[i][j] == b:
				rows[i][j] = 0
if rows[0][0] + rows[0][1] + rows[0][2] == 0 or rows[1][0] + rows[1][1] + rows[1][2] == 0 or rows[2][0] + rows[2][1] + rows[2][2] == 0 or (rows[0][0] + rows[1][0] + rows[2][0] == 0) or (rows[0][1] + rows[1][1] + rows[2][1] == 0) or (rows[0][2] + rows[1][2] + rows[2][2] == 0) or (rows[0][0] + rows[1][1] + rows[2][2] == 0) or (rows[0][2] + rows[1][1] + rows[2][0] == 0):
	print('Yes')
else:
	print('No')


Bingo = [list(map(int, input().split())) for i in range(3)]
n = int(input())
num = [int(input()) for i in range(n)]
Bingo.append([Bingo[0][0], Bingo[1][1], Bingo[2][2]])
Bingo.append([Bingo[0][2], Bingo[1][1], Bingo[2][0]])
for k in range(3):
	Bingo.append([Bingo[0][k], Bingo[1][k], Bingo[2][k]])
k = 0
re = 'No'
for l in range(len(Bingo)):
	if len(list(set(num) & set(Bingo[l]))) == 3:
		re = 'Yes'
		break
print(re)


bingo = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
A = []
for _ in range(3):
	A.extend(list(map(int, input().split())))
N = int(input())
B = [int(input()) for i in range(N)]
C = [0 for _ in range(9)]
for bb in B:
	for (i, aa) in enumerate(A):
		if aa == bb:
			C[i] = 1
for bi in bingo:
	if C[bi[0]] == C[bi[1]] == C[bi[2]] == 1:
		print('Yes')
		exit(0)
print('No')


a = []
for i in range(3):
	a.extend(input().split())
n = int(input())
for i in range(n):
	c = input()
	if c in a:
		a[a.index(c)] = '0'
if a[0] == a[1] == a[2] or a[3] == a[4] == a[5] or a[6] == a[7] == a[8] or (a[0] == a[3] == a[6]) or (a[1] == a[4] == a[7]) or (a[2] == a[5] == a[8]) or (a[0] == a[4] == a[8]) or (a[2] == a[4] == a[6]):
	print('Yes')
else:
	print('No')


a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for j in range(n)]
ans = 'No'
for k in range(n):
	for l in range(3):
		for m in range(3):
			if a[l][m] == b[k]:
				a[l][m] = 0
for o in range(3):
	if a[o][0] == a[o][1] == a[o][2] or a[0][o] == a[1][o] == a[2][o]:
		ans = 'Yes'
if a[0][0] == a[1][1] == a[2][2] or a[2][0] == a[1][1] == a[0][2]:
	ans = 'Yes'
print(ans)


a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
bingo = 'No'
for t in zip(*a):
	a.append(list(t))
a.append([a[i][i] for i in range(3)])
a.append([a[i][2 - i] for i in range(3)])
for line in a:
	if all((item in b for item in line)):
		bingo = 'Yes'
print(bingo)


import numpy as np

def check(A, b):
	A = np.where(A == b, -1, A)
	return A

def bingo(A):
	for a in A:
		if a[0] == a[1] == a[2] == -1:
			return True
	for a in A.T:
		if a[0] == a[1] == a[2] == -1:
			return True
	if A[0][0] == A[1][1] == A[2][2] == -1:
		return True
	if A[0][2] == A[1][1] == A[2][0] == -1:
		return True
	return False
A = []
for _ in range(3):
	A.append(list(map(int, input().split())))
A = np.array(A)
N = int(input())
for _ in range(N):
	b = int(input())
	A = check(A, b)
if bingo(A):
	print('Yes')
else:
	print('No')


l = [list(map(int, input().split())) for i in range(3)]
l = sum(l, [])
n = int(input())
li = set([int(input()) for ini in range(n)])
d = [0 for i in range(9)]
for g in range(9):
	if l[g] in li:
		d[g] = 1
for (a, s, x) in [(0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 4, 8), (2, 4, 6), (0, 3, 6), (1, 4, 7), (2, 5, 8)]:
	if d[a] == d[x] == d[s] == 1:
		print('Yes')
		exit()
print('No')


A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]
sheet = [[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]:
				sheet[j][k] = 1
if sheet[0][0] == 1 and sheet[0][1] == 1 and (sheet[0][2] == 1):
	print('Yes')
elif sheet[1][0] == 1 and sheet[1][1] == 1 and (sheet[1][2] == 1):
	print('Yes')
elif sheet[2][0] == 1 and sheet[2][1] == 1 and (sheet[2][2] == 1):
	print('Yes')
elif sheet[0][0] == 1 and sheet[1][0] == 1 and (sheet[2][0] == 1):
	print('Yes')
elif sheet[0][1] == 1 and sheet[1][1] == 1 and (sheet[2][1] == 1):
	print('Yes')
elif sheet[0][2] == 1 and sheet[1][2] == 1 and (sheet[2][2] == 1):
	print('Yes')
elif sheet[0][0] == 1 and sheet[1][1] == 1 and (sheet[2][2] == 1):
	print('Yes')
elif sheet[2][0] == 1 and sheet[1][1] == 1 and (sheet[0][2] == 1):
	print('Yes')
else:
	print('No')


a = []
for i in range(3):
	a += list(map(int, input().split()))
c = [False] * 9
n = int(input())
for i in range(n):
	b = int(input())
	if b in a:
		c[a.index(b)] = True
d = [[c[0], c[1], c[2]], [c[3], c[4], c[5]], [c[6], c[7], c[8]], [c[0], c[3], c[6]], [c[1], c[4], c[7]], [c[2], c[5], c[8]], [c[0], c[4], c[8]], [c[2], c[4], c[6]]]
if [True, True, True] in d:
	print('Yes')
else:
	print('No')


(A_11, A_12, A_13) = list(map(int, input().split()))
(A_21, A_22, A_23) = list(map(int, input().split()))
(A_31, A_32, A_33) = list(map(int, input().split()))
N = int(input())
Li = [A_11, A_12, A_13, A_21, A_22, A_23, A_31, A_32, A_33]
for i in range(N):
	b = int(input())
	if b in Li:
		Num = Li.index(b)
		Li[Num] = 0
if Li[0] == Li[1] == Li[2] == 0 or Li[3] == Li[4] == Li[5] == 0 or Li[6] == Li[7] == Li[8]:
	print('Yes')
elif Li[0] == Li[3] == Li[6] == 0 or Li[1] == Li[4] == Li[7] == 0 or Li[2] == Li[5] == Li[8]:
	print('Yes')
elif Li[0] == Li[4] == Li[8] == 0 or Li[2] == Li[4] == Li[6] == 0:
	print('Yes')
else:
	print('No')


a = [[*map(int, input().split())] for _ in range(3)]
b = [int(input()) for _ in range(int(input()))]
for i in b:
	for j in range(3):
		if i in a[j]:
			a[j][a[j].index(i)] = -1
if a[0][0] + a[1][1] + a[2][2] == -3 or a[0][2] + a[1][1] + a[2][0] == -3:
	print('Yes')
else:
	for (i, j) in zip(a, [*zip(*a)]):
		if sum(i) == -3 or sum(j) == -3:
			print('Yes')
			break
	else:
		print('No')


A = []
B = [False] * 9
for i in range(3):
	A += [int(i) for i in input().split()]
n = int(input())
for _ in range(n):
	b = int(input())
	for i in range(9):
		if b == A[i]:
			B[i] = True
C = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [1, 4, 7], [2, 5, 8], [3, 6, 9], [1, 5, 9], [3, 5, 7]]
ans = False
for (a, b, c) in C:
	if B[a - 1] and B[b - 1] and B[c - 1]:
		ans = True
print('Yes' if ans else 'No')


a = [list(map(int, input().split())) for i in range(3)]
raw = []
for i in range(3):
	raw.append([a[i][0], a[i][1], a[i][2]])
	raw.append([a[0][i], a[1][i], a[2][i]])
raw.append([a[0][0], a[1][1], a[2][2]])
raw.append([a[0][2], a[1][1], a[2][0]])
cnt = [0] * 8
n = int(input())
for i in range(n):
	b = int(input())
	for j in range(8):
		if b in raw[j]:
			cnt[j] += 1
cnt.sort()
if cnt[-1] == 3:
	print('Yes')
else:
	print('No')


a = []
for i in range(3):
	a += list(map(int, input().split()))
bg = [False] * 9
n = int(input())
for i in range(n):
	b = int(input())
	if b in a:
		bg[a.index(b)] = True
num = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
for (x, y, z) in num:
	if bg[x] and bg[y] and bg[z]:
		print('Yes')
		exit()
print('No')


A = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
B = [int(input()) for _ in range(n)]
li = []
for i in A:
	li.append(i)
for i in range(3):
	li.append([A[0][i], A[1][i], A[2][i]])
li.append([A[0][0], A[1][1], A[2][2]])
li.append([A[0][2], A[1][1], A[2][0]])
for (i, j, k) in li:
	if i in B and j in B and (k in B):
		print('Yes')
		exit()
print('No')


A = []
for i in range(3):
	(a, b, c) = map(int, input().split())
	A += [a, b, c]
n = int(input())
T = [0] * 9
for i in range(n):
	p = int(input())
	if p in A:
		T[A.index(p)] = 1
if [1, 1, 1] in [T[0:3], T[3:6], T[6:9], T[0:7:3], T[1:9:3], T[2:9:3], T[0:10:4], T[2:7:2]]:
	print('Yes')
else:
	print('No')


import numpy as np
CARD_SIZE = 3

def solve(card, called_numbers):
	checked_card = np.vectorize(lambda n: n in called_numbers)(card)
	for l in checked_card:
		if all(l):
			return True
	for l in zip(*checked_card):
		if all(l):
			return True
	if all([checked_card[n][n] for n in range(CARD_SIZE)]):
		return True
	if all([checked_card[n][CARD_SIZE - n - 1] for n in range(CARD_SIZE)]):
		return True
	return False

def resolve():
	card = [[int(row) for row in input().split()] for _ in range(CARD_SIZE)]
	N = int(input())
	called_numbers = {int(input()) for n in range(N)}
	ret = solve(card, called_numbers)
	print('Yes' if ret else 'No')

def __starting_point():
	resolve()
__starting_point()


a = [list(map(int, input().split())), list(map(int, input().split())), list(map(int, input().split()))]
N = int(input())
b = list()
for i in range(0, N):
	b.append(int(input()))
for j in range(0, 3):
	for k in range(0, 3):
		for i in range(0, N):
			if a[j][k] == b[i]:
				a[j][k] = 0
for i in range(0, 3):
	if a[i][0] == a[i][1] and a[i][1] == a[i][2]:
		print('Yes')
		break
	elif a[0][i] == a[1][i] and a[1][i] == a[2][i]:
		print('Yes')
		break
	elif a[0][0] == a[1][1] and a[1][1] == a[2][2]:
		print('Yes')
		break
	elif a[2][0] == a[1][1] and a[1][1] == a[0][2]:
		print('Yes')
		break
else:
	print('No')


A = [[]] * 3
for row in range(3):
	A[row] = list(map(int, input().split()))
n = int(input())
B = [0] * n
for i in range(n):
	B[i] = int(input())
flag = False

def check_bingo(A, B):
	for row in range(3):
		if A[row][0] and A[row][1] and A[row][2]:
			return True
	for col in range(3):
		if A[0][col] and A[1][col] and A[2][col]:
			return True
	if A[0][0] and A[1][1] and A[2][2]:
		return True
	if A[0][2] and A[1][1] and A[2][0]:
		return True
	return False
for row in range(3):
	for col in range(3):
		if A[row][col] in B:
			A[row][col] = True
		else:
			A[row][col] = False
print('Yes' if check_bingo(A, B) else 'No')


a = list()
a[0:2] = map(int, input().split())
a[3:5] = map(int, input().split())
a[6:8] = map(int, input().split())
n = int(input())
for i in range(n):
	b = int(input())
	if b in a:
		a[a.index(b)] = 0
for (i, j, k) in ((0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)):
	if a[i] == a[j] == a[k] == 0:
		print('Yes')
		exit()
print('No')


c = []
for _ in range(3):
	l = list(map(int, input().split()))
	c += l
n = int(input())
for _ in range(n):
	m = int(input())
	if m in c:
		c[c.index(m)] = 0
if c[0] == c[1] == c[2] == 0 or c[3] == c[4] == c[5] == 0 or c[6] == c[7] == c[8] == 0 or (c[0] == c[3] == c[6] == 0) or (c[1] == c[4] == c[7] == 0) or (c[5] == c[8] == c[2] == 0) or (c[0] == c[4] == c[8] == 0) or (c[2] == c[4] == c[6] == 0):
	print('Yes')
else:
	print('No')


n = 3
num_list = []
for i in range(n):
	num_list.append(list(map(int, input().split())))
N = int(input())
list1 = [int(input()) for _ in range(N)]
list2 = []
i = 0
while i <= 2:
	j = 0
	while j <= 2:
		list2.append(num_list[i][j])
		j = j + 1
	i = i + 1
s = 0
for k in list2:
	if list1.count(k) == 1:
		list2[s] = 101
		s = s + 1
	else:
		s = s + 1
		continue
if list2[0] + list2[1] + list2[2] == 303:
	print('Yes')
elif list2[3] + list2[4] + list2[5] == 303:
	print('Yes')
elif list2[6] + list2[7] + list2[8] == 303:
	print('Yes')
elif list2[0] + list2[3] + list2[6] == 303:
	print('Yes')
elif list2[1] + list2[4] + list2[7] == 303:
	print('Yes')
elif list2[2] + list2[5] + list2[8] == 303:
	print('Yes')
elif list2[0] + list2[4] + list2[8] == 303:
	print('Yes')
elif list2[2] + list2[4] + list2[6] == 303:
	print('Yes')
else:
	print('No')


def main():
	A = [list(map(int, input().split())) for i in range(3)]
	N = int(input())
	b = [int(input()) for _ in range(N)]
	for i in range(N):
		for j in range(3):
			for h in range(3):
				if A[j][h] == b[i]:
					A[j][h] = 0
	if A[0][0] == 0 and A[0][1] == 0 and (A[0][2] == 0):
		return 'Yes'
	elif A[1][0] == 0 and A[1][1] == 0 and (A[1][2] == 0):
		return 'Yes'
	elif A[2][0] == 0 and A[2][1] == 0 and (A[2][2] == 0):
		return 'Yes'
	elif A[0][0] == 0 and A[1][0] == 0 and (A[2][0] == 0):
		return 'Yes'
	elif A[0][1] == 0 and A[1][1] == 0 and (A[2][1] == 0):
		return 'Yes'
	elif A[0][2] == 0 and A[1][2] == 0 and (A[2][2] == 0):
		return 'Yes'
	elif A[0][0] == 0 and A[1][1] == 0 and (A[2][2] == 0):
		return 'Yes'
	elif A[0][2] == 0 and A[1][1] == 0 and (A[2][0] == 0):
		return 'Yes'
	return 'No'
print(main())


(a, b, c) = map(int, input().split())
(d, e, f) = map(int, input().split())
(g, h, i) = map(int, input().split())
lst = [a, b, c, d, e, f, g, h, i]
for i in range(int(input())):
	x = int(input())
	for j in range(9):
		if x == lst[j]:
			lst[j] = 0
(a, b, c, d, e, f, g, h, i) = lst
tf = 0
for k in [a + b + c, d + e + f, g + h + i, a + d + g, b + e + h, c + f + i, a + e + i, c + e + g]:
	if not k:
		tf = 1
		break
if tf:
	print('Yes')
else:
	print('No')


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]
for i in range(3):
	if set(A[i]) <= set(b):
		print('Yes')
		exit()
	if set([A[0][i], A[1][i], A[2][i]]) <= set(b):
		print('Yes')
		exit()
if set([A[0][0], A[1][1], A[2][2]]) <= set(b) or set([A[0][2], A[1][1], A[2][0]]) <= set(b):
	print('Yes')
	exit()
print('No')


board = [list(map(int, input().split())) for i in range(3)]
num = int(input())
for n in range(num):
	bi = int(input())
	for i in range(3):
		for j in range(3):
			if board[i][j] == bi:
				board[i][j] = 0
for i in range(3):
	if board[i][0] == board[i][1] == board[i][2] == 0:
		print('Yes')
		return
for i in range(3):
	if board[0][i] == board[1][i] == board[2][i] == 0:
		print('Yes')
		return
if board[0][0] == board[1][1] == board[2][2] == 0:
	print('Yes')
	return
if board[0][2] == board[1][1] == board[2][0] == 0:
	print('Yes')
	return
print('No')


(s, a) = (',036,048,246,258,345,678,', open(0).read().split())
for i in a[9:]:
	s = s.replace(str(a.index(i)), '')
print('NYoe s'[',,' in s::2])


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]
field = 0
for v in b:
	for i in range(9):
		if A[i // 3][i % 3] == v:
			field = field | 1 << i
ans = False
for v in sum([[273, 84], sum([[73 << i, 7 << i * 3] for i in range(3)], [])], []):
	ans = ans or field & v == v
print('Yes' if ans else 'No')


S = '012 345 678 036 147 258 048 246 '
A = []
A.extend((list(map(int, input().split())) for i in range(3)))
N = int(input())
for i in range(N):
	j = input()
	for l in range(3):
		for m in range(3):
			S = S.replace(str([9, l * 3 + m][A[l][m] == int(j)]), '')
print(['No', 'Yes'][S.find('  ') > -1])


A = []
for i in range(3):
	for x in input().split():
		A.append(int(x))
N = int(input())
for _ in range(N):
	y = int(input())
	A = [0 if x == y else x for x in A]
if any((sum(A[::3]) == 0, sum(A[1::3]) == 0, sum(A[2::3]) == 0, sum(A[:3]) == 0, sum(A[3:6]) == 0, sum(A[6:]) == 0, sum(A[::4]) == 0, sum(A[2:7:2]) == 0)):
	print('Yes')
else:
	print('No')


a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
bingo = []
for i in range(3):
	x = a[i]
	for j in range(3):
		bingo.append(x[j])
for i in b:
	for j in range(0, 9):
		if i == bingo[j]:
			bingo[j] = 0
if bingo[0] == 0 and bingo[1] == 0 and (bingo[2] == 0):
	print('Yes')
elif bingo[3] == 0 and bingo[4] == 0 and (bingo[5] == 0):
	print('Yes')
elif bingo[6] == 0 and bingo[7] == 0 and (bingo[8] == 0):
	print('Yes')
elif bingo[0] == 0 and bingo[3] == 0 and (bingo[6] == 0):
	print('Yes')
elif bingo[1] == 0 and bingo[4] == 0 and (bingo[7] == 0):
	print('Yes')
elif bingo[2] == 0 and bingo[5] == 0 and (bingo[8] == 0):
	print('Yes')
elif bingo[0] == 0 and bingo[4] == 0 and (bingo[8] == 0):
	print('Yes')
elif bingo[2] == 0 and bingo[4] == 0 and (bingo[6] == 0):
	print('Yes')
else:
	print('No')


A = [[int(x) for x in input().split()] for i in range(3)]
n = int(input())
B = set((int(input()) for i in range(n)))
res = False
for row in A:
	if all((x in B for x in row)):
		res = True
for j in range(3):
	if all((A[i][j] in B for i in range(3))):
		res = True
if all((A[i][i] in B for i in range(3))):
	res = True
if all((A[i][2 - i] in B for i in range(3))):
	res = True
print('Yes' if res else 'No')


A = []
for i in [0] * 3:
	A += list(map(int, input().split()))
N = int(input())
B = [0] * 9
for i in range(N):
	i = int(input())
	if i in A:
		B[A.index(i)] = 1
res = 0
for i in range(3):
	res += B[3 * i] * B[3 * i + 1] * B[3 * i + 2]
	res += B[i] * B[i + 3] * B[i + 6]
res += B[0] * B[4] * B[8] + B[2] * B[4] * B[6]
print(['No', 'Yes'][res > 0])


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
ans = False
for a in A:
	ans |= set(a) <= set(B)
for i in range(3):
	ans |= set([A[0][i], A[1][i], A[2][i]]) <= set(B)
ans |= set([A[0][0], A[1][1], A[2][2]]) <= set(B)
ans |= set([A[0][2], A[1][1], A[2][0]]) <= set(B)
print('Yes' if ans else 'No')


a = [input().split() for i in range(3)]
n = int(input())
b = [input() for i in range(n)]
flg = 0
for i in range(3):
	for j in range(3):
		if a[i][j] in b:
			a[i][j] = 0
for n in range(3):
	if a[0][n] == a[1][n] == a[2][n]:
		flg = 1
	elif a[n][0] == a[n][1] == a[n][2]:
		flg = 1
	elif a[0][0] == a[1][1] == a[2][2]:
		flg = 1
	elif a[0][2] == a[1][1] == a[2][0]:
		flg = 1
print(['No', 'Yes'][flg])


(a, b, c) = list(map(int, input().split()))
(d, e, f) = list(map(int, input().split()))
(g, h, i) = list(map(int, input().split()))
x = []
y = [a, b, c, d, e, f, g, h, i]
n = int(input())
for s in range(n):
	x.append(int(input()))
for m in range(9):
	if y[m] in x:
		y[m] = 0
if y[0] == y[1] == y[2] == 0:
	print('Yes')
elif y[3] == y[4] == y[5] == 0:
	print('Yes')
elif y[6] == y[7] == y[8] == 0:
	print('Yes')
elif y[0] == y[3] == y[6] == 0:
	print('Yes')
elif y[1] == y[4] == y[7] == 0:
	print('Yes')
elif y[2] == y[5] == y[8] == 0:
	print('Yes')
elif y[0] == y[4] == y[8] == 0:
	print('Yes')
elif y[2] == y[4] == y[6] == 0:
	print('Yes')
else:
	print('No')


l = []
flag = 0
for i in range(3):
	for j in input().split():
		l.append(j)
n = int(input())
for i in range(n):
	a = input()
	if a in l:
		l[l.index(a)] = 0
if not any(l[0:3]) or not any(l[3:6]) or (not any(l[6:9])):
	flag = 1
if not any(l[0::3]) or not any(l[1::3]) or (not any(l[2::3])):
	flag = 1
if not any(l[0::4]) or not any(l[2:7:2]):
	flag = 1
if flag:
	print('Yes')
else:
	print('No')


A = []
A += map(int, input().split())
A += map(int, input().split())
A += map(int, input().split())
N = int(input())
for _ in range(N):
	b = int(input())
	try:
		A[A.index(b)] = 0
	except ValueError:
		pass
res = (A[0] + A[1] + A[2]) * (A[3] + A[4] + A[5]) * (A[6] + A[7] + A[8]) * (A[0] + A[3] + A[6]) * (A[1] + A[4] + A[7]) * (A[2] + A[5] + A[8]) * (A[0] + A[4] + A[8]) * (A[2] + A[4] + A[6])
print('Yes' if res == 0 else 'No')


A = []
for _ in range(3):
	A += list(map(int, input().split()))
N = int(input())
b = []
for _ in range(N):
	b.append(int(input()))
BINGO = [{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 3, 6}, {1, 4, 7}, {2, 5, 8}, {0, 4, 8}, {2, 4, 6}]
hole = set()
for num in b:
	for i in range(9):
		if num == A[i]:
			hole.add(i)
for tri in BINGO:
	if tri <= hole:
		print('Yes')
		break
else:
	print('No')


A = [[int(i) for i in input().split(' ')] for k in range(3)]
N = int(input())
for i in range(N):
	b = int(input())
	for (x, y) in [(x, y) for x in range(3) for y in range(3) if A[x][y] == b]:
		A[x][y] = 0
M = 1
for k in range(3):
	M *= sum((A[i][k] for i in range(3)))
	M *= sum((A[k][i] for i in range(3)))
M *= sum((A[i][i] for i in range(3)))
M *= sum((A[i][2 - i] for i in range(3)))
if M == 0:
	print('Yes')
else:
	print('No')


a = [list(map(int, input().split())) for row in range(3)]
n = int(input())
b = [int(input()) for hoge in range(n)]
a1 = a[0] + a[1] + a[2]
c = []
for poge in a1:
	if poge in b:
		c.append(0)
	else:
		c.append(1)
if min(c[0] + c[1] + c[2], c[3] + c[4] + c[5], c[6] + c[7] + c[8], c[0] + c[3] + c[6], c[1] + c[4] + c[7], c[2] + c[5] + c[8], c[0] + c[4] + c[8], c[2] + c[4] + c[6]) == 0:
	print('Yes')
else:
	print('No')


f = lambda a: any((all(b) for b in a)) | all((a[i][i] for i in (0, 1, 2)))
a = eval('list(map(int,input().split())),' * 3)
exec('b=int(input());a=[[u*(u!=b)for u in t]for t in a];' * int(input()))
a = [[not u for u in t] for t in a]
print('NYoe s'[f(a) | f([t[::-1] for t in zip(*a)])::2])


a = [0] * 3
for i in range(3):
	a[i] = list(map(int, input().split()))
n = int(input())
b = set()
for _ in range(n):
	b.add(int(input()))
if set(a[0]) <= b or set(a[1]) <= b or set(a[2]) <= b or (set((x[0] for x in a)) <= b) or (set((x[1] for x in a)) <= b) or (set((x[2] for x in a)) <= b) or ({a[0][0], a[1][1], a[2][2]} <= b) or ({a[0][2], a[1][1], a[2][0]} <= b):
	print('Yes')
else:
	print('No')


L = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
B = list((int(input()) for _ in range(n)))
ans = 'No'
for i in range(3):
	for j in range(3):
		for b in B:
			if L[i][j] == b:
				L[i][j] = 0
for i in range(3):
	if L[i][0] == L[i][1] == L[i][2] == 0:
		ans = 'Yes'
	if L[0][i] == L[1][i] == L[2][i] == 0:
		ans = 'Yes'
if L[0][0] == L[1][1] == L[2][2] == 0:
	ans = 'Yes'
if L[0][2] == L[1][1] == L[2][0] == 0:
	ans = 'Yes'
print(ans)


S = '012 345 678 036 147 258 048 246 '
A = [input().split() for i in range(3)]
for b in [input() for i in range(int(input()))]:
	for l in range(9):
		S = S.replace(str([9, l][b == (A[0] + A[1] + A[2])[l]]), '')
print(['No', 'Yes'][S.find('  ') > -1])


L = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
for i in B:
	for j in range(3):
		for k in range(3):
			if i == L[j][k]:
				L[j][k] = 0
T = False
for i in range(3):
	if L[i][0] == L[i][1] == L[i][2]:
		T = True
	elif L[0][i] == L[1][i] == L[2][i]:
		T = True
if L[0][0] == L[1][1] == L[2][2] or L[0][2] == L[1][1] == L[2][0]:
	T = True
if T == True:
	print('Yes')
else:
	print('No')


a = [[x for x in map(int, input().split())] for _ in range(3)]
n = int(input())
bingo = [[0] * 3 for _ in range(3)]
for k in range(n):
	x = int(input())
	for i in range(3):
		for j in range(3):
			if a[i][j] == x:
				bingo[i][j] = 1
for i in range(3):
	if bingo[i] == [1, 1, 1]:
		print('Yes')
		return
	if [row[i] for row in bingo] == [1, 1, 1]:
		print('Yes')
		return
if [bingo[i][i] for i in range(3)] == [1, 1, 1]:
	print('Yes')
	return
if [bingo[i][2 - i] for i in range(3)] == [1, 1, 1]:
	print('Yes')
	return
print('No')


from typing import List

def answer(a: List[List[int]], n: int, b: List[int]) -> str:
	bingo_card = list(([i[j] in b for i in a] for j in range(3)))
	for i in range(2):
		for j in bingo_card:
			if all(j):
				return 'Yes'
		if i == 0:
			bingo_card = list(zip(*bingo_card))
	if bingo_card[0][0] and bingo_card[1][1] and bingo_card[2][2]:
		return 'Yes'
	if bingo_card[0][2] and bingo_card[1][1] and bingo_card[2][0]:
		return 'Yes'
	return 'No'

def main():
	a = [list(map(int, input().split())) for _ in range(3)]
	n = int(input())
	b = list((int(input()) for _ in range(n)))
	print(answer(a, n, b))

def __starting_point():
	main()
__starting_point()


(*A,) = map(int, open(0).read().split())
N = A[9]
B = A[10:]
A = A[:9]
T = [False] * 9
for b in B:
	if b in A:
		T[A.index(b)] = True
bingo = [(0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)]
for (a, b, c) in bingo:
	if T[a] and T[b] and T[c]:
		print('Yes')
		break
else:
	print('No')


a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
n = int(input())
flag = 0
for _ in range(n):
	b = int(input())
	for i in range(3):
		if b == a1[i]:
			a1[i] = 0
		elif b == a2[i]:
			a2[i] = 0
		elif b == a3[i]:
			a3[i] = 0
	for i in range(3):
		if a1[i] == a2[i] == a3[i]:
			flag = 1
		if sum(a1) == 0:
			flag = 1
		if sum(a2) == 0:
			flag = 1
		if sum(a3) == 0:
			flag = 1
		if a1[0] == a2[1] == a3[2]:
			flag = 1
		if a1[2] == a2[1] == a3[0]:
			flag = 1
	if flag == 1:
		print('Yes')
		break
if flag == 0:
	print('No')


def main():
	card = [[int(j) for j in input().split()] for i in range(3)]
	n = int(input())

	def punch(v):
		for i in range(len(card)):
			for j in range(len(card[i])):
				if card[i][j] == v:
					card[i][j] = True
		return card

	def check(board):
		for i in range(len(board)):
			l = list(set(board[i]))
			if len(l) == 1 and l[0] == True:
				return True
		for i in range(len(board[0])):
			if board[0][i] == board[1][i] == board[2][i] == True:
				return True
		if board[0][0] == board[1][1] == board[2][2] == True:
			return True
		if board[0][2] == board[1][1] == board[2][0] == True:
			return True
	for _ in range(n):
		num = int(input())
		if check(punch(num)):
			return 'Yes'
	return 'No'
	print(card)

def __starting_point():
	print(main())
__starting_point()


A = []
for _ in range(3):
	for e in list(map(int, input().split())):
		A.append(e)
N = int(input())
for _ in range(N):
	n = int(input())
	if n in A:
		A[A.index(n)] = 0
patterns = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
for pattern in patterns:
	if not any([A[e] for e in pattern]):
		print('Yes')
		exit()
print('No')


l = [list(map(int, input().split())) for i in range(3)]
n = int(input())
s = set([int(input()) for j in range(n)])
ans = 'No'
for i in range(3):
	if l[i][0] in s and l[i][1] in s and (l[i][2] in s):
		ans = 'Yes'
for i in range(3):
	if l[0][i] in s and l[1][i] in s and (l[2][i] in s):
		ans = 'Yes'
if l[0][0] in s and l[1][1] in s and (l[2][2] in s):
	ans = 'Yes'
elif l[0][2] in s and l[1][1] in s and (l[2][0] in s):
	ans = 'Yes'
print(ans)


(A11, A12, A13) = list(map(int, input().split()))
(A21, A22, A23) = list(map(int, input().split()))
(A31, A32, A33) = list(map(int, input().split()))
Alist = []
Alist.append(A11)
Alist.append(A12)
Alist.append(A13)
Alist.append(A21)
Alist.append(A22)
Alist.append(A23)
Alist.append(A31)
Alist.append(A32)
Alist.append(A33)
bingolist = [0] * 9
N = int(input())
for i in range(N):
	b = int(input())
	for j in range(len(bingolist)):
		if b == Alist[j]:
			bingolist[j] = 1
if sum(bingolist[0:3]) == 3 or sum(bingolist[3:6]) == 3 or sum(bingolist[6:9]) == 3 or (bingolist[0] + bingolist[3] + bingolist[6] == 3) or (bingolist[1] + bingolist[4] + bingolist[7] == 3) or (bingolist[2] + bingolist[5] + bingolist[8] == 3) or (bingolist[0] + bingolist[4] + bingolist[8] == 3) or (bingolist[2] + bingolist[4] + bingolist[6] == 3):
	print('Yes')
else:
	print('No')


A = {}
for i in range(3):
	(a1, a2, a3) = map(int, input().split())
	A[a1] = (i, 0)
	A[a2] = (i, 1)
	A[a3] = (i, 2)
N = int(input())
A2 = [[False, False, False] for i in range(3)]
for i in range(N):
	b = int(input())
	if b not in A:
		continue
	(r, c) = map(int, A[b])
	A2[r][c] = True

def isBingo(table):
	for r in range(3):
		if table[r][0] and table[r][1] and table[r][2]:
			return True
	for c in range(3):
		if table[0][c] and table[1][c] and table[2][c]:
			return True
	if table[0][0] and table[1][1] and table[2][2]:
		return True
	if table[0][2] and table[1][1] and table[2][0]:
		return True
	return False
if isBingo(A2):
	print('Yes')
else:
	print('No')


(*A1,) = map(int, input().split())
(*A2,) = map(int, input().split())
(*A3,) = map(int, input().split())
A = A1 + A2 + A3
N = int(input())
a = [int(input()) for _ in range(N)]
chk = [A[:3], A[3:6], A[6:9], A[::3], A[1::3], A[2::3], A[::4], A[2:7:2]]
for c in chk:
	ans = 0
	for cc in c:
		if cc in a:
			ans += 1
	if ans == 3:
		print('Yes')
		exit()
print('No')


a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
N = int(input())
B = {int(input()) for _ in range(N)}
A = a1 + a2 + a3
ijk = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
end = False
for (i, j, k) in ijk:
	if {A[i], A[j], A[k]} <= B:
		print('Yes')
		end = True
		break
	else:
		continue
if not end:
	print('No')


a = [list(map(int, input().split())) for _ in range(3)]
f = [[0] * 3 for _ in range(3)]
for _ in range(int(input())):
	x = int(input())
	for i in range(3):
		for j in range(3):
			if x == a[i][j]:
				f[i][j] = 1
ans = 0
for i in range(3):
	if all((f[i][j] for j in range(3))) or all((f[j][i] for j in range(3))):
		ans = 1
if f[0][0] == f[1][1] == f[2][2] == 1 or f[0][2] == f[1][1] == f[2][0] == 1:
	ans = 1
print('Yes' if ans else 'No')


A = [0] * 9
for i in range(3):
	A[i * 3:i * 3 + 3] = input().split()
for i in range(int(input())):
	b = input()
	for j in range(9):
		if A[j] == b:
			A[j] = '0'
s = '012345678036147258048246'
a = f = 0
for i in range(24):
	a += int(A[int(s[i])])
	if i % 3 == 2:
		if a == 0:
			f += 1
		a = 0
if f > 0:
	print('Yes')
else:
	print('No')


a = list(map(int, input().split()))
a.extend(list(map(int, input().split())))
a.extend(list(map(int, input().split())))
n = int(input())
ins = []
for i in range(n):
	b = int(input())
	if b in a:
		ins.append(a.index(b))
okp = [(0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)]
f = 'No'
for (x, y, z) in okp:
	if x in ins and y in ins and (z in ins):
		f = 'Yes'
		break
print(f)


a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]
for i in range(3):
	for j in range(3):
		if a[i][j] not in b:
			break
		elif j == 2:
			print('Yes')
			return
for i in range(3):
	for j in range(3):
		if a[j][i] not in b:
			break
		elif j == 2:
			print('Yes')
			return
if a[0][0] in b and a[1][1] in b and (a[2][2] in b):
	print('Yes')
	return
if a[0][2] in b and a[1][1] in b and (a[2][0] in b):
	print('Yes')
	return
print('No')


A = []
for i in range(3):
	A.append(list(input().split()))
N = int(input())
B = []
for i in range(N):
	B.append(input())
B = set(B)
if set(A[0]) <= B or set(A[1]) <= B or set(A[2]) <= B or ({A[0][0], A[1][0], A[2][0]} <= B) or ({A[0][1], A[1][1], A[2][1]} <= B) or ({A[0][2], A[1][2], A[2][2]} <= B) or ({A[0][0], A[1][1], A[2][2]} <= B) or ({A[0][2], A[1][1], A[2][0]} <= B):
	print('Yes')
else:
	print('No')


A = [input().split() for _ in range(3)]
N = int(input())
B = [input() for _ in range(N)]
for i in range(3):
	for j in range(3):
		if A[i][j] in B:
			A[i][j] = 0
if A[0][0] == A[1][1] == A[2][2] or A[0][2] == A[1][1] == A[2][0]:
	print('Yes')
	exit()
for n in range(3):
	if A[0][n] == A[1][n] == A[2][n] or A[n][0] == A[n][1] == A[n][2]:
		print('Yes')
		exit()
print('No')


B = []
for _ in range(3):
	B += list(map(int, input().split()))
S = set((int(input()) for _ in range(int(input()))))
for (i, b) in enumerate(B):
	if b in S:
		B[i] = 0
if B[0] + B[1] + B[2] == 0 or B[3] + B[4] + B[5] == 0 or B[6] + B[7] + B[8] == 0 or (B[0] + B[3] + B[6] == 0) or (B[1] + B[4] + B[7] == 0) or (B[2] + B[5] + B[8] == 0) or (B[0] + B[4] + B[8] == 0) or (B[2] + B[4] + B[6] == 0):
	print('Yes')
else:
	print('No')


card = []
for i in range(3):
	card += list(map(int, input().split()))
N = int(input())
bingo = [(1, 2, 3), (4, 5, 6), (7, 8, 9), (1, 4, 7), (2, 5, 8), (3, 6, 9), (1, 5, 9), (3, 5, 7)]
for i in range(N):
	n = int(input())
	if n in card:
		card[card.index(n)] = 'hit'
ans = 'No'
for patt in bingo:
	if card[patt[0] - 1] == card[patt[1] - 1] == card[patt[2] - 1] == 'hit':
		ans = 'Yes'
		break
print(ans)


import sys
read = sys.stdin.readline
import time
from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
from collections import deque

def inp():
	return int(input())

def inpl():
	return list(map(int, input().split()))
start_time = time.perf_counter()
bingo = []
for i in range(3):
	ls = inpl()
	bingo.append(ls)
N = inp()
for i in range(N):
	a = inp()
	for i in range(3):
		for j in range(3):
			if bingo[i][j] == a:
				bingo[i][j] = -1
bl = False
for i in range(3):
	if bingo[i][0] == -1 and bingo[i][1] == -1 and (bingo[i][2] == -1):
		bl = True
	if bingo[0][i] == -1 and bingo[1][i] == -1 and (bingo[2][i] == -1):
		bl = True
if bingo[0][0] == -1 and bingo[1][1] == -1 and (bingo[2][2] == -1):
	bl = True
if bingo[0][2] == -1 and bingo[1][1] == -1 and (bingo[2][0] == -1):
	bl = True
print('Yes' if bl else 'No')
end_time = time.perf_counter()
print('time:', end_time - start_time, file=sys.stderr)


import sys
YES = 'Yes'
NO = 'No'

def solve(A: 'List[List[int]]', N: int, b: 'List[int]'):
	A_ = []
	for a_ in A:
		A_ += [[a__, False] for a__ in a_]
	for b_ in b:
		for a__ in A_:
			if a__[0] == b_:
				a__[1] = True
	if A_[0][1] and (A_[1][1] and A_[2][1] or (A_[3][1] and A_[6][1]) or (A_[4][1] and A_[8][1])) or (A_[1][1] and A_[4][1] and A_[7][1]) or (A_[2][1] and A_[5][1] and A_[8][1]) or (A_[3][1] and A_[4][1] and A_[5][1]) or (A_[6][1] and A_[7][1] and A_[8][1]) or (A_[2][1] and A_[4][1] and A_[6][1]):
		print(YES)
	else:
		print(NO)
	return

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	A = [[int(next(tokens)) for _ in range(3)] for _ in range(3)]
	N = int(next(tokens))
	b = [int(next(tokens)) for _ in range(N)]
	solve(A, N, b)

def __starting_point():
	main()
__starting_point()


import sys
A = []
for a in range(3):
	l = [int(i) for i in input().split()]
	A.extend(l)
f = [0] * 9
for i in range(int(input())):
	b = int(input())
	if b in A:
		f[A.index(b)] = 1
p = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
for i in p:
	if all((f[x] == 1 for x in i)):
		print('Yes')
		sys.exit()
print('No')


a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = set((int(input()) for i in range(n)))

def check():
	for i in range(3):
		if all((a[i][j] in b for j in range(3))):
			return True
		if all((a[j][i] in b for j in range(3))):
			return True
	return all((a[i][i] in b for i in range(3))) or all((a[2 - i][i] in b for i in range(3)))
print('Yes' if check() else 'No')


ls = []
for i in range(3):
	ls += list(map(int, input().split()))
N = int(input())
lsb = [int(input()) for i in range(N)]
for i in range(N):
	if lsb[i] in ls:
		ls[ls.index(lsb[i])] = '#'
ans = 'No'
for i in range(3):
	if ls[0 + i] == '#' and ls[3 + i] == '#' and (ls[6 + i] == '#'):
		ans = 'Yes'
for i in range(3):
	if ls[3 * i] == '#' and ls[3 * i + 1] == '#' and (ls[3 * i + 2] == '#'):
		ans = 'Yes'
if ls[0] == '#' and ls[4] == '#' and (ls[8] == '#'):
	ans = 'Yes'
if ls[2] == '#' and ls[4] == '#' and (ls[6] == '#'):
	ans = 'Yes'
print(ans)


(p, r) = (input, range)
A = sum([list(map(int, p().split())) for _ in r(3)], [])
b = [int(p()) for _ in r(int(p()))]
print('YNeos'[all([sum((1 << i for i in r(9) if A[i] in b)) & v != v for v in [7, 56, 73, 84, 146, 273, 292, 448]])::2])


A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
sheet = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for i in range(N):
	b = int(input())
	for j in range(3):
		for k in range(3):
			if b == A[j][k]:
				sheet[j][k] = 1
				break
			else:
				continue
for i in range(3):
	if sheet[0][i] == sheet[1][i] == sheet[2][i] == 1:
		print('Yes')
		return
for i in range(3):
	if sheet[i][0] == sheet[i][1] == sheet[i][2] == 1:
		print('Yes')
		return
if sheet[0][0] == sheet[1][1] == sheet[2][2] == 1:
	print('Yes')
	return
if sheet[0][2] == sheet[1][1] == sheet[2][0] == 1:
	print('Yes')
	return
else:
	print('No')


(*t,) = map(int, open(0).read().split())
a = t[:9]
s = {10}
for b in t[10:]:
	if b in a:
		s |= {a.index(b)}
print('NYoe s'[any((s >= {i * 3, i * 3 + 1, i * 3 + 2} or s >= {i, i + 3, i + 6} for i in (0, 1, 2))) or s >= {0, 4, 8} or s >= {2, 4, 6}::2])


import sys
a = 3
A = [list(map(int, input().split())) for c in range(a)]
N = int(input())
b = [int(input()) for c in range(N)]
C = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for i in range(3):
	for j in range(3):
		for k in range(N):
			if b[k] == A[i][j]:
				C[i][j] = 1
for i in range(3):
	if sum(C[i]) == 3:
		print('Yes')
		return
for j in range(3):
	if C[0][j] + C[1][j] + C[2][j] == 3:
		print('Yes')
		return
if C[0][0] + C[1][1] + C[2][2] == 3 or C[0][2] + C[1][1] + C[2][0] == 3:
	print('Yes')
	return
print('No')


(a11, a12, a13, a21, a22, a23, a31, a32, a33, n, *b) = map(int, open(0).read().split())
b = set(b)
if {a11, a12, a13} <= b or {a21, a22, a23} <= b or {a31, a32, a33} <= b or ({a11, a21, a31} <= b) or ({a12, a22, a32} <= b) or ({a13, a23, a33} <= b) or ({a11, a22, a33} <= b) or ({a13, a22, a31} <= b):
	print('Yes')
else:
	print('No')


import sys

def __starting_point():
	bingo = [[0] * 3 for i in range(3)]
	ans = [[0] * 3 for i in range(3)]
	for i in range(3):
		temp = list(map(int, input().split()))
		for j in range(3):
			bingo[i][j] = temp[j]
	N = int(input())
	for i in range(N):
		b = int(input())
		for j in range(3):
			for k in range(3):
				if bingo[j][k] == b:
					ans[j][k] = 1
	for i in range(3):
		if ans[0][i] + ans[1][i] + ans[2][i] == 3:
			print('Yes')
			return
	for i in range(3):
		if ans[i][0] + ans[i][1] + ans[i][2] == 3:
			print('Yes')
			return
	if ans[0][0] + ans[1][1] + ans[2][2] == 3:
		print('Yes')
		return
	if ans[0][2] + ans[1][1] + ans[2][0] == 3:
		print('Yes')
		return
	print('No')
__starting_point()


def LIHW(h):
	return [list(map(int, input().split())) for _ in range(h)]

def LIH(h):
	return [int(input()) for _ in range(h)]
card = LIHW(3)
N = int(input())
num = LIH(N)
bingo = [[0, 0, 0] for _ in range(3)]
for i in num:
	for a in range(3):
		for b in range(3):
			if i == card[a][b]:
				bingo[a][b] = 1
				break
ans = 'No'
for i in range(3):
	if bingo[i][0] == 1 and bingo[i][1] == 1 and (bingo[i][2] == 1):
		ans = 'Yes'
for i in range(3):
	if bingo[0][i] == 1 and bingo[1][i] == 1 and (bingo[2][i] == 1):
		ans = 'Yes'
if bingo[0][0] == 1 and bingo[1][1] == 1 and (bingo[2][2] == 1):
	ans = 'Yes'
if bingo[0][2] == 1 and bingo[1][1] == 1 and (bingo[2][0] == 1):
	ans = 'Yes'
print(ans)


bingo = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
D = [[0] * 3 for _ in range(3)]
for _ in range(N):
	b = int(input())
	for i in range(3):
		for j in range(3):
			if b == bingo[i][j]:
				D[i][j] = 1
ans = set()
for d in D:
	ans.add(sum(d))
for d in zip(*D):
	ans.add(sum(d))
ans.add(D[0][0] + D[1][1] + D[2][2])
ans.add(D[0][2] + D[1][1] + D[2][0])
print('Yes' if 3 in ans else 'No')


A = []
for _ in range(3):
	tmp = list(map(int, input().split()))
	A.extend(tmp)
B = [0] * 9
N = int(input())
for _ in range(N):
	tmp = int(input())
	for i in range(9):
		if tmp == A[i]:
			B[i] = 1
ans = 'No'
for (i, j, k) in [(0, 1, 2), (3, 4, 5), (6, 7, 8), (0, 3, 6), (1, 4, 7), (2, 5, 8), (0, 4, 8), (2, 4, 6)]:
	if B[i] + B[j] + B[k] == 3:
		ans = 'Yes'
print(ans)


(a, b, c) = map(int, input().split())
(d, e, f) = map(int, input().split())
(g, h, i) = map(int, input().split())
L = []
L.append({a, b, c})
L.append({d, e, f})
L.append({g, h, i})
L.append({a, d, g})
L.append({b, e, h})
L.append({c, f, i})
L.append({a, e, i})
L.append({c, e, g})
N = int(input())
B = {int(input()) for i in range(N)}
if any((l <= B for l in L)):
	print('Yes')
else:
	print('No')


A = [list(map(int, input().split())) for _ in range(3)]
for j in range(3):
	A.append([A[i][j] for i in range(3)])
A.append([A[0][0], A[1][1], A[2][2]])
A.append([A[2][0], A[1][1], A[0][2]])
d = {int(input()): 0 for _ in range(int(input()))}
print('YNeos'[all((any((d.get(v, 1) for v in r)) for r in A))::2])


a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
for k in range(n):
	b = int(input())
	for i in range(3):
		for j in range(3):
			if a[i][j] == b:
				a[i][j] = 0
	row0 = a[0] == [0, 0, 0]
	row1 = a[1] == [0, 0, 0]
	row2 = a[2] == [0, 0, 0]
	colum0 = [a[0][0], a[1][0], a[2][0]] == [0, 0, 0]
	colum1 = [a[0][1], a[1][1], a[2][1]] == [0, 0, 0]
	colum2 = [a[0][2], a[1][2], a[2][2]] == [0, 0, 0]
	diag0 = [a[0][0], a[1][1], a[2][2]] == [0, 0, 0]
	diag1 = [a[2][0], a[1][1], a[0][2]] == [0, 0, 0]
	if row0 or row1 or row2 or colum0 or colum1 or colum2 or diag0 or diag1:
		print('Yes')
		break
else:
	print('No')


(*a,) = map(int, open(0).read().split())
print('NYoe s'[any((t <= set((a.index(b) for b in a[10:])) for t in ({0, 1, 2}, {0, 3, 6}, {0, 4, 8}, {1, 4, 7}, {2, 4, 6}, {2, 5, 8}, {3, 4, 5}, {6, 7, 8})))::2])


s = ' 012 345 678 036 147 258 048 246 '
a = [input().split() for i in range(3)]
b = a[0] + a[1] + a[2]
for i in [input() for i in range(int(input()))]:
	if i in b:
		s = s.replace(str(b.index(i)), '')
print('Yes' if '  ' in s else 'No')


A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
B = [0 for i in range(8)]
for i in range(N):
	b = int(input())
	if b == A[0][0] or b == A[1][0] or b == A[2][0]:
		B[0] += 1
	if b == A[0][1] or b == A[1][1] or b == A[2][1]:
		B[1] += 1
	if b == A[0][2] or b == A[1][2] or b == A[2][2]:
		B[2] += 1
	if b == A[0][0] or b == A[0][1] or b == A[0][2]:
		B[3] += 1
	if b == A[1][0] or b == A[1][1] or b == A[1][2]:
		B[4] += 1
	if b == A[2][0] or b == A[2][1] or b == A[2][2]:
		B[5] += 1
	if b == A[0][0] or b == A[1][1] or b == A[2][2]:
		B[6] += 1
	if b == A[0][2] or b == A[1][1] or b == A[2][0]:
		B[7] += 1
if 3 in B:
	ans = 'Yes'
else:
	ans = 'No'
print(ans)


a = []
for i in range(3):
	a += list(map(int, input().split()))
n = int(input())
b = []
for i in range(n):
	b = int(input())
	if b in a:
		a[a.index(b)] = 0
ans = 0
if a[0] + a[4] + a[8] == 0 or a[2] + a[4] + a[6] == 0:
	ans = 1
if ans != 1:
	for i in range(3):
		if sum(a[i * 3:i * 3 + 3]) == 0 or a[i] + a[i + 3] + a[i + 6] == 0:
			ans = 1
			break
if ans == 1:
	print('Yes')
else:
	print('No')


a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
for i in range(3):
	for j in range(3):
		if a[i][j] in b:
			a[i][j] = 0
ans = 'No'
for i in range(3):
	if a[0][i] + a[1][i] + a[2][i] == 0:
		ans = 'Yes'
for i in range(3):
	if sum(a[i]) == 0:
		ans = 'Yes'
if a[0][0] + a[1][1] + a[2][2] == 0 or a[0][2] + a[1][1] + a[2][0] == 0:
	ans = 'Yes'
print(ans)


A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
for i in range(N):
	b = int(input())
	for j in range(3):
		for k in range(3):
			if A[j][k] == b:
				A[j][k] = 0
ans = 'No'
for i in range(3):
	if A[i] == [0, 0, 0]:
		ans = 'Yes'
		break
	for j in range(3):
		if A[j][i] != 0:
			break
	else:
		ans = 'Yes'
		break
for i in range(3):
	if A[i][i] != 0:
		break
else:
	ans = 'Yes'
if A[0][2] == 0 and A[1][1] == 0 and (A[2][0] == 0):
	ans = 'Yes'
print(ans)


arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
arr3 = list(map(int, input().split()))
n = int(input())
for _ in range(n):
	x = int(input())
	if x in arr1:
		arr1[arr1.index(x)] -= x
	elif x in arr2:
		arr2[arr2.index(x)] -= x
	elif x in arr3:
		arr3[arr3.index(x)] -= x
	if _ >= 3:
		if arr1[0] == arr1[1] and arr1[1] == arr1[2]:
			print('Yes')
			return
		if arr2[0] == arr2[1] and arr2[1] == arr2[2]:
			print('Yes')
			return
		if arr3[0] == arr3[1] and arr3[1] == arr3[2]:
			print('Yes')
			return
		for jj in range(3):
			if arr1[jj] == arr2[jj] and arr2[jj] == arr3[jj]:
				print('Yes')
				return
		if arr1[0] == arr2[1] and arr2[1] == arr3[2]:
			print('Yes')
			return
		if arr1[2] == arr2[1] and arr2[1] == arr3[0]:
			print('Yes')
			return
print('No')


a = []
for i in range(3):
	a.extend(list(map(int, input().split())))
n = int(input())
b = []
cnt = []
pattern = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
for i in range(n):
	b.append(int(input()))
	for (j, x) in enumerate(a):
		if x == b[i]:
			cnt.append(j)
for (q, w, e) in pattern:
	if q in cnt and w in cnt and (e in cnt):
		print('Yes')
		break
else:
	print('No')


l = []
for i in range(3):
	l += list(map(int, input().split()))
N = int(input())
b = set()
for i in range(N):
	c = int(input())
	if c in l:
		b.add(c)
for i in b:
	l[l.index(i)] = 0
if l[0] + l[1] + l[2] == 0 or l[3] + l[4] + l[5] == 0 or l[6] + l[7] + l[8] == 0:
	print('Yes')
	return
if l[0] + l[3] + l[6] == 0 or l[1] + l[4] + l[7] == 0 or l[2] + l[5] + l[8] == 0:
	print('Yes')
	return
if l[0] + l[4] + l[8] == 0 or l[2] + l[4] + l[6] == 0:
	print('Yes')
	return
print('No')


a_3_3 = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b_n = [int(input()) for _ in range(n)]

class Info:

	def __init__(self, a_3_3, n, b_n):
		self.a_3_3 = a_3_3
		self.n = n
		self.b_n = b_n

	@staticmethod
	def setting():
		for num in b_n:
			for line in a_3_3:
				if num in line:
					line[line.index(num)] = 0
		return a_3_3

	@staticmethod
	def result():
		diagonal_lurd = a_3_3[0][0] + a_3_3[1][1] + a_3_3[2][2]
		diagonal_ldru = a_3_3[2][0] + a_3_3[1][1] + a_3_3[0][2]
		for (index, line) in enumerate(a_3_3):
			row_sum = sum(line)
			col_sum = a_3_3[0][index] + a_3_3[1][index] + a_3_3[2][index]
			if diagonal_lurd == 0 or diagonal_ldru == 0 or row_sum == 0 or (col_sum == 0):
				print('Yes')
				return
		print('No')
info = Info(a_3_3, n, b_n)
info.setting()
info.result()


(a1, a2, a3) = map(int, input().split())
(a4, a5, a6) = map(int, input().split())
(a7, a8, a9) = map(int, input().split())
n = int(input())
b = [int(input()) for _ in range(n)]
bing = [(a1, a2, a3), (a4, a5, a6), (a7, a8, a9), (a1, a4, a7), (a2, a5, a8), (a3, a6, a9), (a1, a5, a9), (a3, a5, a7)]
for cs in bing:
	for c in cs:
		if not c in b:
			break
	else:
		print('Yes')
		break
else:
	print('No')


l = []
(A, B, C) = map(int, input().split())
l.append(A)
l.append(B)
l.append(C)
(D, E, F) = map(int, input().split())
l.append(D)
l.append(E)
l.append(F)
(G, H, I) = map(int, input().split())
l.append(G)
l.append(H)
l.append(I)
N = int(input())
b = {0}
for i in range(N):
	c = int(input())
	if c in l:
		b.add(c)
b.discard(0)
for i in b:
	l[l.index(i)] = 0
if l[0] + l[1] + l[2] == 0 or l[3] + l[4] + l[5] == 0 or l[6] + l[7] + l[8] == 0:
	print('Yes')
	return
if l[0] + l[3] + l[6] == 0 or l[1] + l[4] + l[7] == 0 or l[2] + l[5] + l[8] == 0:
	print('Yes')
	return
if l[0] + l[4] + l[8] == 0 or l[2] + l[4] + l[6] == 0:
	print('Yes')
	return
print('No')


A = [list(map(int, input().split())) for _ in range(3)]
b = [i for i in [int(input()) for _ in range(int(input()))] for j in A if i in j]
A = [[0 if A[i][j] in b else A[i][j] for j in range(len(A[i]))] for i in range(len(A))]
print('NYoe s'[any([1 if sum(i) == 0 else 0 for i in A]) or any([1 if sum(i) == 0 else 0 for i in list(zip(*A))]) or (not A[0][0] + A[1][1] + A[2][2]) or (not A[0][2] + A[1][1] + A[2][0])::2])


A = []
for i in range(3):
	A += list(map(int, input().split()))
N = int(input())
B = []
for i in range(N):
	B.append(int(input()))
B = set(B)
c = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
P = [{0, 3, 6}, {1, 4, 7}, {2, 5, 8}, {0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 4, 8}, {2, 4, 6}]
r = []
for (i, a) in enumerate(A):
	if a in B:
		r.append(i)
r = set(r)
for p in P:
	if p.issubset(r):
		print('Yes')
		break
else:
	print('No')


def check(arr):
	for i in range(len(arr)):
		if arr[i] == ['x', 'x', 'x']:
			return True
	for i in range(3):
		if arr[0][i] == 'x' and arr[1][i] == 'x' and (arr[2][i] == 'x'):
			return True
	if arr[0][0] == 'x' and arr[1][1] == 'x' and (arr[2][2] == 'x'):
		return True
	elif arr[0][2] == 'x' and arr[1][1] == 'x' and (arr[2][0] == 'x'):
		return True
	return False
arr = []
for _ in range(3):
	arr.append(list(map(int, input().split(' '))))
n = int(input())
for _ in range(n):
	b = int(input())
	for i in range(len(arr)):
		tmp_arr = []
		for ele in arr[i]:
			if b == ele:
				tmp_arr.append('x')
			else:
				tmp_arr.append(ele)
		arr[i] = tmp_arr
if check(arr) == True:
	print('Yes')
else:
	print('No')


A1 = list(map(str, input().split()))
A2 = list(map(str, input().split()))
A3 = list(map(str, input().split()))
N = int(input())
for k in range(N):
	i = str(input())
	if i == A1[0]:
		A1[0] = 'OK'
	if i == A1[1]:
		A1[1] = 'OK'
	if i == A1[2]:
		A1[2] = 'OK'
	if i == A2[0]:
		A2[0] = 'OK'
	if i == A2[1]:
		A2[1] = 'OK'
	if i == A2[2]:
		A2[2] = 'OK'
	if i == A3[0]:
		A3[0] = 'OK'
	if i == A3[1]:
		A3[1] = 'OK'
	if i == A3[2]:
		A3[2] = 'OK'
if A1 == ['OK', 'OK', 'OK'] or A2 == ['OK', 'OK', 'OK'] or A3 == ['OK', 'OK', 'OK']:
	print('Yes')
	return
for i in range(3):
	if A1[i] == 'OK' and A2[i] == 'OK' and (A3[i] == 'OK'):
		print('Yes')
		return
if A1[0] == 'OK' and A2[1] == 'OK' and (A3[2] == 'OK'):
	print('Yes')
	return
if A1[2] == 'OK' and A2[1] == 'OK' and (A3[0] == 'OK'):
	print('Yes')
	return
print('No')


table = [[0] * 3 for _ in range(3)]
A = [list(map(int, input().split())) for _ in range(3)]
A = sum(A, [])
N = int(input())
B = [int(input()) for _ in range(N)]
for b in B:
	tmp = [i for (i, x) in enumerate(A) if x == b]
	for t in tmp:
		table[t // 3][t % 3] = 1
flag = False
(n1, n2) = (0, 0)
for i in range(3):
	if sum(table[i]) == 3:
		flag = True
	if sum([table[j][i] for j in range(3)]) == 3:
		flag = True
	n1 += table[i][i]
	n2 += table[i][2 - i]
if n1 == 3 or n2 == 3:
	flag = True
if flag:
	print('Yes')
else:
	print('No')


sheet = []
lines = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
sai = []
for i in range(3):
	sheet += [int(j) for j in input().split()]
n = int(input())
for i in range(n):
	sai.append(int(input()))
ret = 'No'
for line in lines:
	bingo = True
	for l in line:
		if sheet[l] not in sai:
			bingo = False
	if bingo:
		ret = 'Yes'
print(ret)


a = []
for _ in range(3):
	a += list(map(int, input().split()))
n = int(input())
b = {int(input()): None for _ in range(n)}
r = [ai in b for ai in a]
combs = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
if any([all([r[c] for c in comb]) for comb in combs]):
	print('Yes')
else:
	print('No')


def ii():
	return int(input())

def mi():
	return map(int, input().split())
a = []
for _ in range(3):
	a += list(mi())
n = ii()
b = []
for i in range(n):
	b += (ii(),)

def ana(x):
	if x in b:
		return 1
	else:
		return 0
c = [ana(aa) for aa in a]
oks = '012 345 678 036 147 258 048 246'.split()
for ok in oks:
	res = 1
	for j in list(ok):
		res *= c[int(j)]
	if res == 1:
		print('Yes')
		exit()
print('No')


a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
(q, l, r) = (0, 0, 0)
for _ in range(n):
	b = int(input())
	for i in range(3):
		if b in a[i]:
			a[i][a[i].index(b)] = 0
for i in range(3):
	l += a[i][i]
	(t, y) = (0, 0)
	for j in range(3):
		y += a[j][i]
		t += a[i][j]
		if i + j == 2:
			r += a[i][j]
	if not t or not y:
		q = 1
print('Yes' if q or not l or (not r) else 'No')


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
d = [a[0], b[0], c[0]]
e = [a[1], b[1], c[1]]
f = [a[2], b[2], c[2]]
g = [a[0], b[1], c[2]]
h = [a[2], b[1], c[0]]
n = int(input())
bs = []
for _ in range(n):
	bs.append(int(input()))
for l in [a, b, c, d, e, f, g, h]:
	if l[0] in bs and l[1] in bs and (l[2] in bs):
		print('Yes')
		break
else:
	print('No')


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
A = sum(A, [])
for b in B:
	if b in A:
		A[A.index(b)] = -1
if A[0] == A[1] == A[2] or A[3] == A[4] == A[5] or A[6] == A[7] == A[8] or (A[0] == A[3] == A[6]) or (A[1] == A[4] == A[7]) or (A[2] == A[5] == A[8]) or (A[0] == A[4] == A[8]) or (A[2] == A[4] == A[6]):
	print('Yes')
else:
	print('No')


row1 = map(int, input().split())
row2 = map(int, input().split())
row3 = map(int, input().split())
row = list(row1) + list(row2) + list(row3)
bs = [int(input()) for i in range(int(input()))]
comb = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
for lst in comb:
	if len([1 for num in lst if row[num] in bs]) == 3:
		print('Yes')
		exit()
print('No')


def ck_bingo(lis):
	flg = False
	for i in range(0, 3):
		if lis[i][0] + lis[i][1] + lis[i][2] == 3:
			flg = True
			break
	for j in range(0, 3):
		if lis[0][j] + lis[1][j] + lis[2][j] == 3:
			flg = True
			break
	if lis[0][0] + lis[1][1] + lis[2][2] == 3 or lis[0][2] + lis[1][1] + lis[2][0] == 3:
		flg = True
	return flg
Bingo = [[0] for _ in range(3)]
for b in range(3):
	Bingo[b] = list(map(int, input().split()))
N = int(input())
A = [[0, 0, 0] for _ in range(3)]
Ans = 'No'
for i in range(N):
	ball = int(input())
	for j in range(3):
		for k in range(3):
			if ball == Bingo[j][k]:
				A[j][k] = 1
				if ck_bingo(A):
					Ans = 'Yes'
print(Ans)


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]
for i in range(N):
	for j in range(3):
		for k in range(3):
			if b[i] == A[j][k]:
				A[j][k] = 0
ans = 'No'
for i in range(3):
	if all((c == 0 for c in [A[i][0], A[i][1], A[i][2]])):
		ans = 'Yes'
for i in range(3):
	if all((c == 0 for c in [A[0][i], A[1][i], A[2][i]])):
		ans = 'Yes'
if all((c == 0 for c in [A[0][0], A[1][1], A[2][2]])):
	ans = 'Yes'
if all((c == 0 for c in [A[0][2], A[1][1], A[2][0]])):
	ans = 'Yes'
print(ans)


a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
ans = [[0] * 3 for _ in range(3)]
for i in range(n):
	b = int(input())
	for j in range(3):
		for k in range(3):
			if a[j][k] == b:
				ans[j][k] = 1
state = False
for i in range(3):
	num = 0
	for j in range(3):
		num += ans[i][j]
	if num == 3:
		state = True
for i in range(3):
	num = 0
	for j in range(3):
		num += ans[j][i]
	if num == 3:
		state = True
if ans[0][0] + ans[1][1] + ans[2][2] == 3:
	state = True
if ans[0][2] + ans[1][1] + ans[2][0] == 3:
	state = True
if state:
	print('Yes')
else:
	print('No')


a = [input().split() for _ in range(3)]
n = int(input())
b = [input() for _ in range(n)]
a1 = []
for i in range(3):
	a1.append(a[0][i])
for i in range(3):
	a1.append(a[1][i])
for i in range(3):
	a1.append(a[2][i])
for i in range(n):
	if b[i] in a1:
		w = a1.index(b[i])
		a1[w] = 'a'
	else:
		pass
if a1[0] == a1[1] == a1[2] == 'a' or a1[3] == a1[4] == a1[5] == 'a' or a1[6] == a1[7] == a1[8] == 'a':
	print('Yes')
elif a1[0] == a1[3] == a1[6] == 'a' or a1[1] == a1[4] == a1[7] == 'a' or a1[2] == a1[5] == a1[8] == 'a':
	print('Yes')
elif a1[0] == a1[4] == a1[8] == 'a' or a1[2] == a1[4] == a1[6] == 'a':
	print('Yes')
else:
	print('No')


li = list(map(int, input().split()))
li1 = list(map(int, input().split()))
li2 = list(map(int, input().split()))
n = int(input())
li3 = []
for i in range(n):
	li3.append(int(input()))
for i in range(3):
	if li[i] in li3:
		li[i] = 0
	if li1[i] in li3:
		li1[i] = 0
	if li2[i] in li3:
		li2[i] = 0
su = li[0] + li1[0] + li2[0]
su1 = li[1] + li1[1] + li2[1]
su2 = li[2] + li1[2] + li2[2]
su3 = li[0] + li1[1] + li2[2]
su4 = li[2] + li1[1] + li2[0]
if sum(li) == 0 or sum(li1) == 0 or sum(li2) == 0:
	print('Yes')
elif su == 0 or su1 == 0 or su2 == 0:
	print('Yes')
elif su3 == 0 or su4 == 0:
	print('Yes')
else:
	print('No')


f = lambda a: any((all(b) for b in a)) | all((a[i][i] for i in (0, 1, 2)))
(*t,) = map(int, open(0).read().split())
a = t[:9]
s = eval('[0]*3,' * 3)
for b in t[10:]:
	if b in a:
		i = a.index(b)
		s[i // 3][i % 3] = 1
print('NYoe s'[f(s) | f([t[::-1] for t in zip(*s)])::2])


def main():
	A = []
	C = [False] * 9
	for i in range(3):
		(a0, a1, a2) = map(int, input().split())
		A.append(a0)
		A.append(a1)
		A.append(a2)
	N = int(input())
	for i in range(N):
		b = int(input())
		if b in A:
			C[A.index(b)] = True
	for i in range(3):
		if C[0 + 3 * i] and C[1 + 3 * i] and C[2 + 3 * i]:
			print('Yes')
			return
	for i in range(3):
		if C[i] and C[i + 3] and C[i + 6]:
			print('Yes')
			return
	if C[0] and C[4] and C[8]:
		print('Yes')
		return
	if C[2] and C[4] and C[6]:
		print('Yes')
		return
	print('No')
main()


import numpy as np
arr = np.array([list(map(int, input().split())) for _ in range(3)])
n = int(input())
for _ in range(n):
	b = int(input())
	arr[np.where(arr == b)] = 0
ans1 = (np.sum(arr, axis=0) == 0).sum() >= 1
ans2 = (np.sum(arr, axis=1) == 0).sum() >= 1
ans3 = (np.diag(arr) == 0).sum() == 3
ans4 = (np.diag(np.rot90(arr)) == 0).sum() == 3
print('Yes' if ans1 or ans2 or ans3 or ans4 else 'No')


X = [list(map(int, input().split())) for i in range(3)]
b = [int(input()) for i in range(int(input()))]
for i in range(3):
	X[i] = [1 if i in b else 0 for i in X[i]]
print('Yes' if 3 <= max(*[sum(i) for i in X], *[sum([x[i] for x in X]) for i in range(3)], X[0][0] + X[1][1] + X[2][2], X[0][2] + X[1][1] + X[2][0]) else 'No')


A = [[], [], []]
A[0] = [int(s) for s in input().split(' ')]
A[1] = [int(s) for s in input().split(' ')]
A[2] = [int(s) for s in input().split(' ')]
N = int(input())
B = []
for n in range(N):
	b = int(input())
	B.append(b)
B = set(B)
lines = []
lines.append(set(A[0]))
lines.append(set(A[1]))
lines.append(set(A[2]))
lines.append(set((A[i][i] for i in range(3))))
lines.append(set((A[2 - i][i] for i in range(3))))
lines.append(set((A[i][0] for i in range(3))))
lines.append(set((A[i][1] for i in range(3))))
lines.append(set((A[i][2] for i in range(3))))
for line in lines:
	if len(line & B) == 3:
		print('Yes')
		return
print('No')


a = list(map(int, input().split())) + list(map(int, input().split())) + list(map(int, input().split()))
n = int(input())
b = [int(input()) for _ in range(n)]
open = []
for i in range(n):
	if b[i] in a:
		open.append(a.index(b[i]))
correct = [{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {2, 5, 8}, {1, 4, 7}, {0, 3, 6}, {0, 4, 8}, {2, 4, 6}]
for i in correct:
	if i <= set(open):
		print('Yes')
		break
else:
	print('No')


f = lambda : list(map(int, input().split()))
la = f() + f() + f()
sb = set()
n = int(input())
for i in range(n):
	b = int(input())
	if b in la:
		sb.add(la.index(b))
ls = [{0, 1, 2}, {0, 3, 6}, {0, 4, 8}, {1, 4, 7}, {2, 4, 6}, {2, 5, 8}, {3, 4, 5}, {6, 7, 8}]
for s in ls:
	if s <= sb:
		print('Yes')
		break
else:
	print('No')


l = []
for _ in range(3):
	l += list(map(int, input().split()))
n = int(input())
for _ in range(n):
	b = int(input())
	if b in l:
		l[l.index(b)] = 0
for i in range(3):
	if sum(l[0 + 3 * i:3 + 3 * i]) == 0:
		print('Yes')
		exit()
	if sum(l[i:9:3]) == 0:
		print('Yes')
		exit()
if l[0] + l[4] + l[8] == 0:
	print('Yes')
	exit()
if l[2] + l[4] + l[6] == 0:
	print('Yes')
	exit()
print('No')


S = '012 345 678 036 147 258 048 246 '
A = sum([input().split() for i in range(3)], [])
for b in [input() for i in range(int(input()))]:
	if b in A:
		S = S.replace(str(A.index(b)), '')
print('YNeos'[S.find('  ') < 0::2])


a = [int(j) for i in range(3) for j in input().split(' ')]
n = int(input())
nn = [int(input()) for i in range(n)]
cnt = 0
for ni in nn:
	if ni in a:
		cnt += 1
		a[a.index(ni)] = 0
judge = 'No'
for i in range(3):
	if sum(a[i::3]) == 0 or sum(a[i * 3:i * 3 + 3]) == 0:
		judge = 'Yes'
if sum(a[::4]) == 0 or a[2] + a[4] + a[6] == 0:
	judge = 'Yes'
print(judge)


a = [input().split() for _ in range(3)]
n = int(input())
b = [input() for _ in range(n)]
p = []
p += a
p += [list(a_) for a_ in zip(*a)]
p += [[a[x][x] for x in range(3)]]
p += [[a[x][2 - x] for x in range(3)]]
for p_ in p:
	for x in p_:
		if x in b:
			continue
		else:
			break
	else:
		print('Yes')
		break
else:
	print('No')


import numpy as np
A1 = np.array(list(map(int, input().split())))
A2 = np.array(list(map(int, input().split())))
A3 = np.array(list(map(int, input().split())))
A = np.concatenate([A1, A2, A3]).reshape(3, 3)
N = int(input())
for i in range(N):
	b = int(input())
	A[np.where(A == b)] = 0
if np.all(A[0, :] == 0) or np.all(A[1, :] == 0) or np.all(A[2, :] == 0) or np.all(A[:, 0] == 0) or np.all(A[:, 1] == 0) or np.all(A[:, 2] == 0) or (A[0, 0] ** 2 + A[1, 1] ** 2 + A[2, 2] ** 2 == 0) or (A[0, 2] ** 2 + A[1, 1] ** 2 + A[2, 0] ** 2 == 0):
	print('Yes')
else:
	print('No')


l = [list(map(int, input().split(' '))) for i in range(3)]
n = int(input())
for i in range(n):
	b = int(input())
	for j in range(3):
		for k in range(3):
			if l[j][k] == b:
				l[j][k] = -1
if l[0][0] == -1 and l[0][1] == -1 and (l[0][2] == -1):
	print('Yes')
elif l[1][0] == -1 and l[1][1] == -1 and (l[1][2] == -1):
	print('Yes')
elif l[2][0] == -1 and l[2][1] == -1 and (l[2][2] == -1):
	print('Yes')
elif l[0][0] == -1 and l[1][0] == -1 and (l[2][0] == -1):
	print('Yes')
elif l[0][1] == -1 and l[1][1] == -1 and (l[2][1] == -1):
	print('Yes')
elif l[0][2] == -1 and l[1][2] == -1 and (l[2][2] == -1):
	print('Yes')
elif l[0][0] == -1 and l[1][1] == -1 and (l[2][2] == -1):
	print('Yes')
elif l[0][2] == -1 and l[1][1] == -1 and (l[2][0] == -1):
	print('Yes')
else:
	print('No')


A = []
for i in range(3):
	(p, q, r) = map(int, input().split())
	A.append(p)
	A.append(q)
	A.append(r)
n = int(input())
for i in range(n):
	b = int(input())
	if b in A:
		A[A.index(b)] = 0
if A[0] == A[1] == A[2] == 0 or A[3] == A[4] == A[5] == 0 or A[6] == A[7] == A[8] == 0 or (A[0] == A[3] == A[6] == 0) or (A[1] == A[4] == A[7] == 0) or (A[2] == A[5] == A[8] == 0) or (A[0] == A[4] == A[8] == 0) or (A[2] == A[4] == A[6] == 0):
	print('Yes')
else:
	print('No')


import sys
x = []
for i in range(3):
	(a, b, c) = map(int, input().split())
	x.append(a)
	x.append(b)
	x.append(c)
n = int(input())
p = [int(input()) for i in range(n)]
for i in range(9):
	if x[i] in p:
		x[i] = 0

def ch(s, d):
	global x
	if x[s] == 0 and x[s + d] == 0 and (x[s + d + d] == 0):
		print('Yes')
		sys.exit()
d = 1
ch(0, d)
ch(3, d)
ch(6, d)
d = 3
for i in range(3):
	ch(i, d)
ch(2, 2)
ch(0, 4)
print('No')


L = []
for i in range(3):
	(a, b, c) = map(int, input().split())
	L += [a, b, c]
N = int(input())
l = [int(input()) for i in range(N)]
a = [0] * 9
for i in l:
	for j in range(9):
		if i == L[j]:
			a[j] = 1
if a[0] * a[1] * a[2] or a[3] * a[4] * a[5] or a[6] * a[7] * a[8] or a[0] * a[3] * a[6] or a[1] * a[4] * a[7] or a[2] * a[5] * a[8] or a[0] * a[4] * a[8] or a[6] * a[4] * a[2]:
	print('Yes')
else:
	print('No')


A = []
for _ in range(3):
	A += list(map(int, input().split()))
N = int(input())
B = [int(input()) for _ in range(N)]
C = [0] * 9
for i in B:
	if i in A:
		x = A.index(i)
		C[x] = 1
if C[0] * C[1] * C[2] == 1 or C[3] * C[4] * C[5] == 1 or C[6] * C[7] * C[8] == 1 or (C[0] * C[3] * C[6] == 1) or (C[1] * C[4] * C[7] == 1) or (C[2] * C[5] * C[8] == 1) or (C[0] * C[4] * C[8] == 1) or (C[2] * C[4] * C[6] == 1):
	print('Yes')
else:
	print('No')


import numpy as np
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
a = [[False] * 3 for _ in range(3)]
for i in range(3):
	for j in range(3):
		for b in B:
			if A[i][j] == b:
				a[i][j] = True
bingo = False
for i in range(3):
	if a[i][0] and a[i][1] and a[i][2]:
		bingo = True
for j in range(3):
	if a[0][j] and a[1][j] and a[2][j]:
		bingo = True
if a[0][0] and a[1][1] and a[2][2]:
	bingo = True
if a[0][2] and a[1][1] and a[2][0]:
	bingo = True
print('Yes' if bingo else 'No')


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]
bingo = False
for i in range(3):
	if A[i][0] in B and A[i][1] in B and (A[i][2] in B) or (A[0][i] in B and A[1][i] in B and (A[2][i] in B)):
		bingo = True
if A[0][0] in B and A[1][1] in B and (A[2][2] in B) or (A[0][2] in B and A[1][1] in B and (A[2][0] in B)):
	bingo = True
print('Yes' if bingo else 'No')


A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
bn = [int(input()) for _ in range(N)]
flag = False
for row in A:
	if all((item in bn for item in row)):
		flag = True
for col in zip(*A):
	if all((item in bn for item in col)):
		flag = True
if all((A[i][i] in bn for i in range(3))):
	flag = True
if all((A[i][3 - 1 - i] in bn for i in range(3))):
	flag = True
print('Yes' if flag else 'No')


A = []
a = [1] * 9
for i in range(3):
	A += input().split()
n = int(input())
for i in range(n):
	b = input()
	if b in A:
		a[A.index(b)] = 0
for i in range(3):
	if a[3 * i] + a[3 * i + 1] + a[3 * i + 2] == 0 or a[i] + a[i + 3] + a[i + 6] == 0:
		print('Yes')
		break
else:
	if a[0] + a[4] + a[8] == 0 or a[2] + a[4] + a[6] == 0:
		print('Yes')
	else:
		print('No')


A = []
for _ in range(3):
	A += list(map(int, input().split()))
N = int(input())
res = 'No'
for _ in range(N):
	b = int(input())
	if b in A:
		ind = A.index(b)
		A[ind] = -1
if any((all((a == -1 for a in A[3 * i:3 * i + 3])) for i in range(3))):
	res = 'Yes'
if any((all((a == -1 for a in A[i::3])) for i in range(3))):
	res = 'Yes'
if any((all((A[i] == -1 for i in a)) for a in [[0, 4, 8], [2, 4, 6]])):
	res = 'Yes'
print(res)


a_str = [input().split() for _ in range(3)]
a = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for i in range(3):
	for j in range(3):
		a[i][j] = int(a_str[i][j])
n = int(input())
b = [int(input()) for _ in range(n)]
for m in range(n):
	for i in range(3):
		for j in range(3):
			if b[m] == a[i][j]:
				a[i][j] = 0
for i in range(3):
	if a[i][0] == a[i][1] == a[i][2] == 0:
		print('Yes')
		return
for i in range(3):
	if a[0][i] == a[1][i] == a[2][i] == 0:
		print('Yes')
		return
if a[0][0] == a[1][1] == a[2][2] == 0:
	print('Yes')
	return
if a[0][2] == a[1][1] == a[2][0] == 0:
	print('Yes')
	return
print('No')


a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
n = int(input())
a = a1 + a2 + a3
b = set([int(input()) for _ in range(n)])
c1 = set(a[0::3])
c2 = set(a[1::3])
c3 = set(a[2::3])
c4 = set([a1[0], a2[1], a3[2]])
c5 = set([a1[2], a2[1], a3[0]])
c = [set(a1), set(a2), set(a3), c1, c2, c3, c4, c5]
j = any((len(b & x) == 3 for x in c))
print('Yes' if j else 'No')


a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
for i in range(n):
	x = int(input())
	for j in range(3):
		if x in a[j]:
			a[j][a[j].index(x)] = 0
for i in range(3):
	if a[i][0] == a[i][1] == a[i][2] == 0 or a[0][i] == a[1][i] == a[2][i] == 0 or a[0][0] == a[1][1] == a[2][2] == 0 or (a[0][2] == a[1][1] == a[2][0] == 0):
		print('Yes')
		break
else:
	print('No')