using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Text;

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        void Omame()
        {
            cin = new Scanner();
            int[,] bingo = new int[3, 3];
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    bingo[i, j] = cin.nextInt();
                }
            }
            int N = cin.nextInt();
            for (int i = 0; i < N; i++)
            {
                int no = cin.nextInt();
                for (int j = 0; j < 3; j++)
                {
                    for (int k = 0; k < 3; k++)
                    {
                        if (bingo[j, k] == no)
                        {
                            bingo[j, k] = -1;
                        }
                    }
                }
            }

            for (int i = 0; i < 3; i++)
            {
                if (bingo[i, 0] + bingo[i, 1] + bingo[i, 2] == -3)
                {
                    Console.WriteLine("Yes");
                    return;
                }
                if (bingo[0, i] + bingo[1, i] + bingo[2, i] == -3)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }
            if(bingo[0,0] + bingo[1,1] + bingo[2,2] == -3)
            {
                Console.WriteLine("Yes");
                return;
            }

            if(bingo[2,0] + bingo[1,1] + bingo[0,2] == -3)
            {
                Console.WriteLine("Yes");
                return;
            }

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


Measured memory_bytes: 11220