using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        // 最小公倍数
        public static long Lcm(long a, long b)
        {
            return a * b / Gcd(a, b);
        }

        // ユークリッドの互除法 
        public static long Gcd(long a, long b)
        {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }

        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.ReadLine();
        }

        public void Solve(ConsoleInput cin)
        {
            int[] a1 = cin.ReadIntArray(3);
            int[] a2 = cin.ReadIntArray(3);
            int[] a3 = cin.ReadIntArray(3);
            bool[,] nuketa = new bool[3, 3];
            int n = cin.ReadInt;
            int[] b = cin.ReadIntArray(n);
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    if (a1[j] == b[i])
                    {
                        nuketa[0, j] = true;
                    }
                }
                for (int j = 0; j < 3; j++)
                {
                    if (a2[j] == b[i])
                    {
                        nuketa[1, j] = true;
                    }
                }
                for (int j = 0; j < 3; j++)
                {
                    if (a3[j] == b[i])
                    {
                        nuketa[2, j] = true;
                    }
                }
            }

            if(nuketa[0, 0] && nuketa[1, 0] && nuketa[2, 0])
            {
                Console.WriteLine("Yes");
                Console.ReadLine();

                return;
            }            
            if(nuketa[0, 1] && nuketa[1, 1] && nuketa[2, 1])
            {
                Console.WriteLine("Yes");
                Console.ReadLine();

                return;

            }
            if (nuketa[0, 2] && nuketa[1, 2] && nuketa[2, 2])
            {
                Console.WriteLine("Yes");
                Console.ReadLine();

                return;

            }
            if (nuketa[0, 0] && nuketa[0, 1] && nuketa[0, 2])
            {
                Console.WriteLine("Yes");
                Console.ReadLine();

                return;

            }
            if (nuketa[1, 0] && nuketa[1, 1] && nuketa[1, 2])
            {
                Console.WriteLine("Yes");
                Console.ReadLine();

                return;

            }
            if (nuketa[2, 0] && nuketa[2, 1] && nuketa[2, 2])
            {
                Console.WriteLine("Yes");
                Console.ReadLine();

                return;

            }
            if (nuketa[0, 0] && nuketa[1, 1] && nuketa[2, 2])
            {
                Console.WriteLine("Yes");
                Console.ReadLine();

                return;

            }
            if (nuketa[0, 2] && nuketa[1, 1] && nuketa[2, 0])
            {
                Console.WriteLine("Yes");
                Console.ReadLine();

                return;

            }
            Console.WriteLine("No");
            Console.ReadLine();

        }
    }
    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }

    public class Util
    {
        //nCrを計算したいときに使用
        public static ModInt Comb(int n, int r)
        {
            ModInt res = 1;
            for (int i = 1; i <= r; i++)
            {
                res *= n;
                res /= i;
                n--;
            }
            return res;
        }

        //n^mを計算
        public static ModInt Power(ModInt n, long m)
        {
            ModInt pow = n;
            ModInt res = 1;
            while (m > 0)
            {
                if ((m & 1) == 1) res *= pow;
                pow *= pow;
                m >>= 1;
            }
            return res;
        }
    }


    public struct ModInt
    {
        public const int Mod = 1000000007;
        const long POSITIVIZER = ((long)Mod) << 31;
        long Data;
        public ModInt(long data) { if ((Data = data % Mod) < 0) Data += Mod; }
        public static implicit operator long(ModInt modInt) => modInt.Data;
        public static implicit operator ModInt(long val) => new ModInt(val);
        public static ModInt operator -(ModInt a, int b) => new ModInt() { Data = (a.Data - b + POSITIVIZER) % Mod };
        public static ModInt operator -(ModInt a, ModInt b) { long res = a.Data - b.Data; return new ModInt() { Data = res < 0 ? res + Mod : res }; }
        public static ModInt operator *(ModInt a, int b) => new ModInt(a.Data * b);
        public static ModInt operator *(ModInt a, ModInt b) => new ModInt() { Data = a.Data * b.Data % Mod };
        public static ModInt operator /(ModInt a, ModInt b) => new ModInt() { Data = a.Data * GetInverse(b) % Mod };
        public override int GetHashCode() => (int)Data;
        static long GetInverse(long a)
        {
            long div, p = Mod, x1 = 1, y1 = 0, x2 = 0, y2 = 1;
            while (true)
            {
                if (p == 1) return x2 + Mod; div = a / p; x1 -= x2 * div; y1 -= y2 * div; a %= p;
                if (a == 1) return x1 + Mod; div = p / a; x2 -= x1 * div; y2 -= y1 * div; p %= a;
            }
        }
    }
}


Measured memory_bytes: 13396