#include <bits/stdc++.h>
using namespace std;

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b)
{
    return b ? gcd(b, a % b) : a;
}
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

const string YES = "Yes";
const string NO = "No";

void func(std::vector<std::vector<long long>> A, std::vector<std::vector<long long>> B, long long N, std::vector<long long> b)
{
    rep(i, N)
    {
        int value = b[i];
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                if (A[i][j] == value)
                {
                    B[i][j] = true;
                    if (B[0][0] && B[0][1] && B[0][2])
                    {
                        cout << "Yes" << endl;
                        return;
                    }
                    else if (B[0][0] && B[1][0] && B[2][0])
                    {
                        cout << "Yes" << endl;
                        return;
                    }
                    else if (B[0][0] && B[1][1] && B[2][2])
                    {
                        cout << "Yes" << endl;
                        return;
                    }
                    else if (B[0][1] && B[1][1] && B[2][1])
                    {
                        cout << "Yes" << endl;
                        return;
                    }
                    else if (B[1][0] && B[1][1] && B[1][2])
                    {
                        cout << "Yes" << endl;
                        return;
                    }
                    else if (B[2][0] && B[2][1] && B[2][2])
                    {
                        cout << "Yes" << endl;
                        return;
                    }
                    else if (B[0][2] && B[1][1] && B[2][0])
                    {
                        cout << "Yes" << endl;
                        return;
                    }
                    else if (B[0][2] && B[1][2] && B[2][2])
                    {
                        cout << "Yes" << endl;
                        return;
                    }
                }
            }
        }
    }
    cout << "No" << endl;
}

int main()
{
    // cout << fixed << setprecision(5);

    std::vector<std::vector<long long>> A(3, std::vector<long long>(3));
    vector<vector<long long>> B(3, std::vector<long long>(3));
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            scanf("%lld", &A[i][j]);
            B[i][j] = false;
        }
    }
    long long N;
    scanf("%lld", &N);
    std::vector<long long> b(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &b[i]);
    }
    func(std::move(A), move(B), N, std::move(b));
    return 0;
}


Measured memory_bytes: 256