using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var A = new List<List<int>>();
            foreach (var i in Enumerable.Range(0, 3))
            {
                A.Add(Console.ReadLine().Split().Select(elem => int.Parse(elem)).ToList());
            }

            // 穴をあける
            var N = int.Parse(Console.ReadLine());
            foreach (var i in Enumerable.Range(0, N))
            {
                var b = int.Parse(Console.ReadLine());
                var coordinate = Coordinate.GetHitCoordinate(A, b);
                if (coordinate != null)
                {
                    A[coordinate.I][coordinate.J] = 0;
                }
            }

            // ビンゴチェック
            var answer = "No";
            do
            {
                // 横
                foreach (var i in Enumerable.Range(0, 3))
                {
                    if (A[i][0] == 0 && A[i][1] == 0 && A[i][2] == 0)
                    {
                        answer = "Yes";
                        break;
                    }
                }

                if (answer == "Yes")
                {
                    break;
                }

                // 縦
                foreach (var j in Enumerable.Range(0, 3))
                {
                    if (A[0][j] == 0 && A[1][j] == 0 && A[2][j] == 0)
                    {
                        answer = "Yes";
                        break;
                    }
                }

                if (answer == "Yes")
                {
                    break;
                }

                // 斜め
                {
                    if (A[0][0] == 0 && A[1][1] == 0 && A[2][2] == 0)
                    {
                        answer = "Yes";
                        break;
                    }

                    if (A[0][2] == 0 && A[1][1] == 0 && A[2][0] == 0)
                    {
                        answer = "Yes";
                        break;
                    }
                }
            }
            while (false);

            Console.WriteLine(answer);
        }

    }

    class Coordinate
    {
        public int I { get; set; }
        public int J { get; set; }

        public static Coordinate GetHitCoordinate(List<List<int>> A, int item)
        {
            foreach (var i in Enumerable.Range(0, A.Count))
            {
                foreach (var j in Enumerable.Range(0, A[i].Count))
                {
                    if (item == A[i][j])
                    {

                        return new Coordinate { I = i, J = j };
                    }
                }
            }

            return null;
        }
    }
}


Measured memory_bytes: 11348