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

#define loop(i, n) for(int i = 0;i < int(n);i++)
#define rloop(i, n) for(int i = int(n);i >= 0;i--)
#define range(i, a, b) for(int i = int(a);i <= int(b);i++)
#define sz(c) int(c.size())
#define clr(v, d)   memset(v, d, sizeof(v))
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define INF             INT64_MAX
#define NINF            INT64_MIN
#define ROW 1001
#define COL 1001

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<pll> vll;
typedef vector<ll> vl;
int alpha[26];

int k;
long long compute_hash(string const& s) {
    const int p = 31;
    const int m = 1e9 + 9;
    long long hash_value = 0;
    long long p_pow = 1;
    for (char c : s) {
        hash_value = (hash_value + (c - 'a' + 1) * p_pow) % m;
        p_pow = (p_pow * p) % m;
    }
    return hash_value;
}
vector<vector<int>> group_identical_strings(vector<string> const& s) {
    int n = s.size();
    vector<pair<long long, int>> hashes(n);
    for (int i = 0; i < n; i++)
        hashes[i] = {compute_hash(s[i]), i};

    sort(hashes.begin(), hashes.end());

    vector<vector<int>> groups;
    for (int i = 0; i < n; i++) {
        if (i == 0 || hashes[i].first != hashes[i-1].first)
            groups.emplace_back();
        groups.back().push_back(hashes[i].second);
    }
    return groups;
}
int count_unique_substrings(string const& s,int *freq) {
    int n = s.size();

    const int p = 31;
    const int m = 1e9 + 9;
    vector<long long> p_pow(n);
    p_pow[0] = 1;
    for (int i = 1; i < n; i++)
        p_pow[i] = (p_pow[i-1] * p) % m;

    vector<long long> h(n + 1, 0);
    for (int i = 0; i < n; i++)
        h[i+1] = (h[i] + (s[i] - 'a' + 1) * p_pow[i]) % m;

    int cnt = 0;
    for (int l = 1; l <= n; l++) {
        set<long long> hs;
        for (int i = 0; i <= n - l; i++) {
            long long cur_h = (h[i + l] + m - h[i]) % m;
            cur_h = (cur_h * p_pow[n-i-1]) % m;
            string tmp=s.substr(i,l);
            if(freq[i+l]-freq[i]<=k){
                pair<set<long long>::iterator,bool> set_out;
                set_out=hs.insert(cur_h);
//                if(set_out.second)
//                    cout<<tmp<<endl;
            }
        }
        cnt += hs.size();

    }

    return cnt;
}
int main(void){
    int arr[3][3];

    loop(i,3)
            loop(j,3)
                cin>>arr[i][j];
    int n;
    cin>>n;
    loop(k,n)
    {
        int x;
        cin>>x;
        loop(i,3){
            loop(j,3)
            {
                if(arr[i][j]==x)
                    arr[i][j]=1;
            }
        }


    }
    loop(i,3){

            if((arr[i][0]+arr[i][1]+arr[i][2])==3)
            {
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    loop(i,3){

            if((arr[0][i]+arr[1][i]+arr[2][i])==3)
            {
                cout<<"Yes"<<endl;
                return 0;
            }
        }

    if((arr[0][0]+arr[1][1]+arr[2][2])==3)
    {
        cout<<"Yes"<<endl;
        return 0;
    }
    if((arr[0][2]+arr[1][1]+arr[2][0])==3)
    {
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;





    return 0;
}


Measured memory_bytes: 256