#!/usr/bin/env python
import numpy as np

A = np.array([list((int(_) for _ in input().split())) for x in range(3)])
N = int(input())
b = {int(input()) for _ in range(N)}

ans = "No"
for i in range(3):
    if (set(A[i, :]) <= b) or (set(A[:, i]) <= b):
        ans = "Yes"
if ({A[0][0], A[1][1], A[2][2]} <= b) or ({A[0][2], A[1][1], A[2][0]} <= b):
    ans = "Yes"

print(ans)
