using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;

namespace at_coder
{
#if TEST
    [TestClass]
#endif
    public class Test_157_b
{
        
#if TEST
        public static void Test_Main()
#else
        public static void Main()
#endif
        {
            var boad = new int[3,3];

            for(int i=0;i<3;i++)
            {
                var ar = ReadIntArray();
                boad[i, 0] = ar[0];
                boad[i, 1] = ar[1];
                boad[i, 2] = ar[2];
            }

            int N = ReadInt();

            for(int i=0;i<N;i++)
            {
                int b = ReadInt();
                SetNum(boad, b);
            }
            
            if (CheckBingo(boad))
            {
                Console.WriteLine("Yes");
            } 
            else
            {
                Console.WriteLine("No");
            }
        }

        private static bool CheckBingo(int[,] boad)
        {
            // 縦
            for(int i=0;i<3;i++)
            {
                int ngCount = 0;
                for (int j=0;j<3;j++)
                {
                    if (boad[i,j] != 0)
                    {
                        ngCount++;
                    }
                }
                if (ngCount == 0)
                {
                    return true;
                }
            }
            // 横
            for (int i = 0; i < 3; i++)
            {
                int ngCount = 0;
                for (int j = 0; j < 3; j++)
                {
                    if (boad[j, i] != 0)
                    {
                        ngCount++;
                    }
                }
                if (ngCount == 0)
                {
                    return true;
                }
            }
            // 斜め
            {
                int ngCount = 0;
                for (int i = 0; i < 3; i++)
                {
                    if (boad[i, i] != 0)
                    {
                        ngCount++;
                    }
                }
                if (ngCount == 0)
                {
                    return true;
                }
            }
            {
                int ngCount = 0;
                for (int i = 0; i < 3; i++)
                {
                    if (boad[2 - i, i] != 0)
                    {
                        ngCount++;
                    }
                }
                if (ngCount == 0)
                {
                    return true;
                }
            }

            return false;
        }

        private static void SetNum(int[,] boad, int b)
        {
            for(int i=0;i<3;i++)
            {
                for(int j=0;j<3;j++)
                {
                    if (boad[i,j] == b)
                    {
                        boad[i, j] = 0;
                    }
                }
            }
        }

        private static int[] ReadIntArray()
        {
            string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int[] ar = new int[ss.Length];
            for (int i = 0; i < ss.Length; i++)
            {
                ar[i] = int.Parse(ss[i]);
            }
            return ar;
        }

        private static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
#if TEST
#else
    }
}
#endif


Measured memory_bytes: 11092