import sys, re

from collections import deque, defaultdict, Counter

from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians

from itertools import accumulate, permutations, combinations, product, groupby

from operator import itemgetter, mul

from copy import deepcopy

from string import ascii_lowercase, ascii_uppercase, digits

from bisect import bisect, bisect_left

from fractions import gcd

from heapq import heappush, heappop

from functools import reduce

def input(): return sys.stdin.readline().strip()

def INT(): return int(eval(input()))

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

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

def ZIP(n): return list(zip(*(MAP() for _ in range(n))))

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

mod = 10 ** 9 + 7

import numpy as np



A1 = LIST()

A2 = LIST()

A3 = LIST()

N = INT()

B = np.ones(N)

for i in range(N):

  B[i] = INT()

  

B = list(B)



def bingo_array(A, B):

  for i in range(3):

    for x in B:

      if A[i] == x:

        A[i] *= 0

       

bingo_array(A1, B)

bingo_array(A2, B)

bingo_array(A3, B)



if sum(A1) == 0 or sum(A2) == 0 or sum(A3) == 0:

  print("Yes")

elif A1[0]+A2[0]+A3[0] == 0 or A1[1]+A2[1]+A3[1] == 0 or A1[2]+A2[2]+A3[2] == 0:

  print("Yes")

elif A1[0]+A2[1]+A3[2] == 0 or A1[2]+A2[1]+A3[0] == 0:

  print("Yes")

else:

  print("No")
import sys, re

from collections import deque, defaultdict, Counter

from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians

from itertools import accumulate, permutations, combinations, product

from operator import itemgetter, mul

from copy import deepcopy

from string import ascii_lowercase, ascii_uppercase, digits

from bisect import bisect, bisect_left

from fractions import gcd

from heapq import heappush, heappop

from functools import reduce

def input(): return sys.stdin.readline().strip()

def INT(): return int(eval(input()))

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

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

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

mod = 10 ** 9 + 7



A = [LIST() for _ in range(3)]

N = INT()

b = [INT() for _ in range(N)]



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



for n in b:

  for i in range(3):

    for j in range(3):

      if A[i][j] == n:

        check[i][j] = 1



for i in range(3):

  if sum(check[i]) == 3:

    print("Yes")

    exit()



for i in range(3):

  if check[0][i] and check[1][i] and check[2][i]:

    print("Yes")

    exit()

    

if check[0][0] and check[1][1] and check[2][2]:

  print("Yes")

  exit()

  

if check[0][2] and check[1][1] and check[2][0]:

  print("Yes")

  exit()

  

print("No")
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce


def input():
    return sys.stdin.readline().strip()


def INT():
    return int(eval(input()))


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


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


def ZIP(n):
    return list(zip(*(MAP() for _ in range(n))))


sys.setrecursionlimit(10**9)
INF = float("inf")
mod = 10**9 + 7
import numpy as np

A1 = LIST()
A2 = LIST()
A3 = LIST()
N = INT()
B = np.ones(N)
for i in range(N):
    B[i] = INT()
B = list(B)


def bingo_array(A, B):
    for i in range(3):
        for x in B:
            if A[i] == x:
                A[i] *= 0


bingo_array(A1, B)
bingo_array(A2, B)
bingo_array(A3, B)
if sum(A1) == 0 or sum(A2) == 0 or sum(A3) == 0:
    print("Yes")
elif (
    A1[0] + A2[0] + A3[0] == 0
    or A1[1] + A2[1] + A3[1] == 0
    or A1[2] + A2[2] + A3[2] == 0
):
    print("Yes")
elif A1[0] + A2[1] + A3[2] == 0 or A1[2] + A2[1] + A3[0] == 0:
    print("Yes")
else:
    print("No")

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce


def input():
    return sys.stdin.readline().strip()


def INT():
    return int(eval(input()))


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


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


sys.setrecursionlimit(10**9)
INF = float("inf")
mod = 10**9 + 7
A = [LIST() for _ in range(3)]
N = INT()
b = [INT() for _ in range(N)]
check = [[0] * 3 for _ in range(3)]
for n in b:
    for i in range(3):
        for j in range(3):
            if A[i][j] == n:
                check[i][j] = 1
for i in range(3):
    if sum(check[i]) == 3:
        print("Yes")
        exit()
for i in range(3):
    if check[0][i] and check[1][i] and check[2][i]:
        print("Yes")
        exit()
if check[0][0] and check[1][1] and check[2][2]:
    print("Yes")
    exit()
if check[0][2] and check[1][1] and check[2][0]:
    print("Yes")
    exit()
print("No")

-from itertools import accumulate, permutations, combinations, product, groupby +from itertools import accumulate, permutations, combinations, product -def ZIP(n): -    return list(zip(*(MAP() for _ in range(n)))) - - -import numpy as np - -A1 = LIST() -A2 = LIST() -A3 = LIST() +A = [LIST() for _ in range(3)] -B = np.ones(N) -for i in range(N): -    B[i] = INT() -B = list(B) - - -def bingo_array(A, B): +b = [INT() for _ in range(N)] +check = [[0] * 3 for _ in range(3)] +for n in b: -        for x in B: -            if A[i] == x: -                A[i] *= 0 - - -bingo_array(A1, B) -bingo_array(A2, B) -bingo_array(A3, B) -if sum(A1) == 0 or sum(A2) == 0 or sum(A3) == 0: +        for j in range(3): +            if A[i][j] == n: +                check[i][j] = 1 +for i in range(3): +    if sum(check[i]) == 3: +        print("Yes") +        exit() +for i in range(3): +    if check[0][i] and check[1][i] and check[2][i]: +        print("Yes") +        exit() +if check[0][0] and check[1][1] and check[2][2]: -elif ( -    A1[0] + A2[0] + A3[0] == 0 -    or A1[1] + A2[1] + A3[1] == 0 -    or A1[2] + A2[2] + A3[2] == 0 -): +    exit() +if check[0][2] and check[1][1] and check[2][0]: -elif A1[0] + A2[1] + A3[2] == 0 or A1[2] + A2[1] + A3[0] == 0: -    print("Yes") -else: -    print("No") +    exit() +print("No")