import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

A = [na() for _ in range(3)]
n = ni()
b = [ni() for _ in range(n)]
bing = [["x"]*3 for i in range(3)]
for i in range(n):
  for j in range(3):
    if b[i] == A[0][j]:
      bing[0][j] = "o"
  for j in range(3):
    if b[i] == A[1][j]:
      bing[1][j] = "o"
  for j in range(3):
    if b[i] == A[2][j]:
      bing[2][j] = "o"

for i in range(3):
  if bing[i] == ["o","o","o"] or (bing[0][i] == "o" and bing[1][i] == "o" and bing[2][i] == "o"):
    print("y")
if (bing[0][0] == "o" and bing[1][1] == "o" and bing[2][2] == "o") or(bing[0][2] == "o" and bing[1][1] == "o" and bing[2][0] == "o"):
  print("y")
else:
  print("n")
