using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using System.Text;
 
class DandA {
    static void Main(string[] args) {
        List<int[]> aList = new List<int[]>();
        for (int i = 0; i < 3;i++) {
            int[] a1 = ReadLineIntArray();
            aList.Add(a1);
        }
        int n = ReadLineInt();
      　int[,] rtn = new int[3,3];
        for (int i = 0; i < n;i++) {
            int b = ReadLineInt();
            for (int j = 0; j < 3;j++) {
                for (int k = 0; k < 3;k++) {
                    if (aList[j][k] == b) {
                        rtn[j, k] = 1;
                    }
                }
            }
        }
        if (rtn[0,0] + rtn[0,1] + rtn[0,2] == 3 ||
           rtn[1,0] + rtn[1,1] + rtn[1,2] == 3 ||
           rtn[2,0] + rtn[2,1] + rtn[2,2] == 3 ||
           rtn[0,0] + rtn[1,0] + rtn[2,0] == 3 ||
           rtn[0,1] + rtn[1,1] + rtn[2,1] == 3 ||
           rtn[0,2] + rtn[1,2] + rtn[2,2] == 3 ||
           rtn[0,0] + rtn[1,1] + rtn[2,2] == 3 ||
           rtn[0,2] + rtn[1,1] + rtn[2,0] == 3 ) {
            Console.WriteLine("Yes");
        } else {
            Console.WriteLine("No");
        }
    }
 
    static string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
    static string[] strAry = new string[] {"L", "R", "U", "D"};
    static int[] intArray = new int[10];
    static List<int> intList = new List<int>();
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private long ReadLineLong() {return long.Parse(Console.ReadLine());}
    static private double ReadLineDouble() {return double.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private double[] ReadLineDoubleArray() {return Console.ReadLine().Trim().Split().Select(a => double.Parse(a)).ToArray();}
    static private decimal[] ReadLineDecimalArray() {return Console.ReadLine().Trim().Split().Select(a => decimal.Parse(a)).ToArray();}
    static private List<int> ReadLineIntList() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToList();}
    static private List<long> ReadLineLongList() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToList();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}
 
    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
  
    static private string IntToNString(int x, int n) {
        var nstring = "";
        var numbers = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
        int r = 1;
        int q = x;
        while (q > 0) {
            r = q % n;
            nstring += numbers[r];
            q = q / n;
        }
        return string.Join("",nstring.Reverse());
     }
}

Measured memory_bytes: 13396