namespace AtCoderCS
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Text;
    using static System.Console;
    using static System.Math;

    class Program
    {
        void Solve()
        {
            var A = new int[3, 3];
            for (var i = 0; i < 3; i++)
            {
                for (var j = 0; j < 3; j++)
                {
                    A[i, j] = cin.Int;
                }
            }

            var N = cin.Int;
            var b = new int[N];
            for (var i = 0; i < N; i++)
            {
                b[i] = cin.Int;
            }

            var set = new HashSet<int>(b);
            var flag = false;
            var tmp = false;
            
            // h 
            for (var i = 0; i < 3; i++)
            {
                tmp = true;
                for (var j = 0; j < 3; j++)
                {
                    tmp &= set.Contains(A[i, j]);
                }

                flag |= tmp;
            }

            // v 
            for (var i = 0; i < 3; i++)
            {
                tmp = true;
                for (var j = 0; j < 3; j++)
                {
                    tmp &= set.Contains(A[j, i]);
                }

                flag |= tmp;
            }

            // \ 
            tmp = true;
            for (var i = 0; i < 3; i++)
            {
                tmp &= set.Contains(A[i, i]);
            }
            flag |= tmp;
            
            // / 
            tmp = true;
            for (var i = 0; i < 3; i++)
            {
                tmp &= set.Contains(A[i, 2 - i]);
            }
            flag |= tmp;

            WriteLine(flag ? "Yes" : "No");
        }

        private SimpleInput cin = new SimpleInput();
        private SimpleOutput cout = new SimpleOutput();

        void Stream()
        {
            Solve();
            cout.Flush();
        }

        static void Main(string[] args)
            => new Program().Stream();
    }

    #region IO

    class SimpleInput
    {
        private string[] _nextBuffer;
        private int _bufferCnt;
        private readonly char[] _cs = new char[] {' ', '"', ','};

        public SimpleInput()
        {
            _nextBuffer = new string[0];
            _bufferCnt = 0;
        }

        string Next()
        {
            if (_bufferCnt < _nextBuffer.Length) return _nextBuffer[_bufferCnt++];
            var st = ReadLine();
            while (st == string.Empty) st = ReadLine();
            if (st != null) _nextBuffer = st.Split(_cs, StringSplitOptions.RemoveEmptyEntries);
            _bufferCnt = 0;
            return _nextBuffer[_bufferCnt++];
        }

        public string String => Next();
        public char Char => char.Parse(String);
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
    }

    class SimpleOutput
    {
        private readonly StreamWriter _sw = new StreamWriter(OpenStandardOutput())
        {
#if DEBUG
            AutoFlush = true
#else
            AutoFlush = false
#endif
        };

        public SimpleOutput()
        {
            SetOut(_sw);
        }

        public void Flush() => Out.Flush();
    }

    #endregion
}

Measured memory_bytes: 13280