#include <bits/stdc++.h>

using namespace std;
using ll = int64_t;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using mii = map<int, int>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using tpi = tuple<int, int, int>;

using vqi = vector<queue<int>>;
using vpi = vector<pii>;
using bs = bitset<60>;
using vbi = vector<bs>;

ll gcd(ll a, ll b) {
    if (a < b) {
        swap(a, b);
    }

    /* ユークリッドの互除法 */
    ll r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

constexpr int64_t __pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
    if (p == 0) {
        return 1;
    }
    if (p % 2 == 0) {
        int64_t t = __pow_mod(n, p / 2, mod);
        return (t * t) % mod;
    }
    return (n * (__pow_mod(n, p - 1, mod) % mod)) % mod;
}

constexpr int64_t pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
    int64_t res = __pow_mod(n, p, mod);
    if (res == 0) {
        res = mod;
    }
    return res;
}

constexpr int64_t nCr_mod(int64_t n, int64_t r, int64_t mod) noexcept {
    int64_t count = 1;
    auto a = r;
    for (auto i = n; i > n - r; i--) {
        count *= i;
        if (count % mod != 0) {
            count %= mod;
        }
        int64_t inv = pow_mod(a, mod - 2, mod);
        count *= inv;
        if (count % mod != 0) {
            count %= mod;
        }
        a--;
    }
    return count;
}

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

void solve(std::vector<std::vector<long long>> A, long long N,
           std::vector<long long> b) {
    for (int i = 0; i < 3; i++) {
        bool tmp = false;
        for (int j = 0; j < 3; j++) {
            auto&& iter = find(b.begin(), b.end(), A[i][j]);
            if (iter != b.end()) {
                tmp = true;
            } else {
                tmp=false;
                break;
            }
        }
        if (tmp) {
            cout << YES << endl;
            return;
        }
    }
    for (int i = 0; i < 3; i++) {
        bool tmp = false;
        for (int j = 0; j < 3; j++) {
            auto&& iter = find(b.begin(), b.end(), A[j][i]);
            if (iter != b.end()) {
                tmp = true;
            } else {
                tmp=false;

                break;
            }
        }
        if (tmp) {
            cout << YES << endl;
            return;
        }
    }

    bool tmp = false;
    for (int j = 0; j < 3; j++) {
        auto&& iter = find(b.begin(), b.end(), A[j][j]);
        if (iter != b.end()) {
            tmp = true;
        } else {
            tmp=false;

            break;
        }
    }
    if (tmp) {
        cout << YES << endl;
        return;
    }

    tmp = false;
    for (int j = 0; j < 3; j++) {
        auto&& iter = find(b.begin(), b.end(), A[2 - j][j]);
        if (iter != b.end()) {
            tmp = true;
        } else {
            tmp=false;

            break;
        }
    }
    if (tmp) {
        cout << YES << endl;
    } else {
        cout << NO << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
    std::vector<std::vector<long long>> A(3, std::vector<long long>(3));
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            std::cin >> A[i][j];
        }
    }
    long long N;
    std::cin >> N;
    std::vector<long long> b(N);
    for (int i = 0; i < N; i++) {
        std::cin >> b[i];
    }
    solve(std::move(A), N, std::move(b));
    return 0;
}


Measured memory_bytes: 256