#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <iomanip>
#include <type_traits>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
//constexpr long long MOD = 1e9 + 7;
//constexpr long long MAX = 1000000;

//long long MOD = 998244353;
constexpr ll INF = 1e17;
constexpr double PI = 3.141592653589793;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

ll h, w;
vector<ll> dx = { -1, 0, 1, 0 };
vector<ll> dy = { 0, -1, 0, 1 };


bool isInField(ll x, ll y) {
    bool f = x >= 0 && x < w && y >= 0 && y < h;
    return f;
}

bool compare_first(pair<ll, ll> x, pair<ll, ll> y)
{
    if (x.first != y.first) {
        return x.first < y.first;
    }
    else {
        return x.second < y.second;
    }
}

bool compare_second(pair<ll, ll> x, pair<ll, ll> y)
{
    if (x.second != y.second) {
        return x.second < y.second;
    }
    else {
        return x.first < y.first;
    }
}

struct {
    bool operator()(pair<string, int> x, pair<string, int> y) const
    {
        return x.second <= y.second && x.first < y.first;
    }
} compare_map;

const ll MAX = 500000000;
const ll MOD = 1000000007;

vector<ll> dijkstra(const vector<vector<pair<ll, ll>>>& graph, int start) {
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;
    vector<ll> dist(graph.size(), INF);
    dist[start] = 0l;
    pq.push(pair<ll, ll>(dist[start], start));
    while (!pq.empty()) {
        auto p = pq.top();
        pq.pop();
        int d = p.first;
        int from = p.second;
        if (dist[from] < d) continue;
        for (auto next : graph[from]) {
            int to = next.first;
            int cost = next.second;
            if (dist[from] + cost < dist[to]) {
                dist[to] = dist[from] + cost;
                pq.push(pair<ll, ll>(dist[to], to));
            }
        }
    }
    return dist;
}


int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    vector<vector<int>> a(3, vector<int>(3));

    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> a[i][j];
        }
    }

    int n;
    cin >> n;

    for (int k = 0; k < n; k++)
    {
        int b;
        cin >> b;
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                if (b == a[i][j]) {
                    a[i][j] = -1;
                }
            }
        }

    }

    if ((a[0][0] == -1 && a[0][1] == -1 && a[0][2] == -1) ||
        (a[1][0] == -1 && a[1][1] == -1 && a[1][2] == -1) ||
        (a[2][0] == -1 && a[2][1] == -1 && a[2][2] == -1) ||
        (a[0][0] == -1 && a[1][0] == -1 && a[2][0] == -1) ||
        (a[0][1] == -1 && a[1][1] == -1 && a[2][1] == -1) ||
        (a[0][2] == -1 && a[1][2] == -1 && a[2][2] == -1) ||
        (a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1) ||
        (a[2][0] == -1 && a[1][1] == -1 && a[0][2] == -1))
    {
        cout << "Yes" << "\n";
    }
    else {
        cout << "No" << "\n";
    }

    return 0;
}



Measured memory_bytes: 256