#include <bits/stdc++.h>
#define endl '\n'
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define pb push_back
#define ff first
#define ss second
#define all(v) (v).begin(), (v).end()
#define mod (int)(1e9+7)
using namespace std;

int gcd(int a, int b){
    return b == 0 ? a : gcd(b, a%b);
}
int lcm(int a, int b){
    return (a*b)/gcd(a,b);
}
int pow1(int x, unsigned int y) { 
    int temp; 
    if( y == 0) 
        return 1; 
    temp = pow1(x, y/2); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return ((x*temp)%mod*(temp)%mod)%mod; 
} 
int inv_mod(int a){
    int res = 1;
    int mod_temp = mod-2;
    while(mod_temp){
        if(mod_temp&1){
            res = ((res%mod)*(a%mod))%mod;
        }
        a = ((a%mod)*(a%mod))%mod;
        mod_temp >>= 1;
    }
    return res%mod;
}
int ncr(int n, int k){
    int res = 1;
    if ( k > n - k )
        k = n - k;

    for (int i = 0; i < k; ++i){
        res = ((res%mod)*((n - i)%mod))%mod;
        res = ((res%mod)*(inv_mod(i + 1)%mod))%mod;
    }
    return res%mod;
}
int fibonacci(int n){
    double phi = (1LL + sqrt(5))/(double)2;
    int nth_fib = round(pow(phi,n)/sqrt(5));
    return nth_fib;
}
#define s set1
signed main(){

    fastIO
    
    int arr[3][3], set1[3][3];
    memset(set1, 0, sizeof(set1));
    for(int i= 0; i< 3; i++){
        for( int j = 0 ; j < 3 ; j++){
            cin >> arr[i][j];
        }
    }
    int n;cin >> n;
    for(int i =0; i< n;i++){
        int temp;
        cin >> temp;
        
        for(int i= 0; i< 3; i++){
            for( int j = 0 ; j < 3 ; j++){
                if(temp == arr[i][j]){
                    set1[i][j] = 1;
                    break;
                }
            }
        }
    }
    if(s[0][0] == 1 && s[0][1] == 1 && s[0][2] == 1){
        cout << "Yes";
        return 0 ;
    }
    if(s[1][0] == 1 && s[1][1] == 1 && s[1][2] == 1){
        cout << "Yes";
        return 0 ;
    }
    if(s[2][0] == 1 && s[2][1] == 1 && s[2][2] == 1){
        cout << "Yes";
        return 0 ;
    }

    if(s[0][0] == 1 && s[1][0] == 1 && s[2][0] == 1){
        cout << "Yes";
        return 0 ;
    }
    if(s[0][1] == 1 && s[1][1] == 1 && s[1][2] == 1){
        cout << "Yes";
        return 0 ;
    }
    if(s[0][2] == 1 && s[1][2] == 1 && s[2][2] == 1){
        cout << "Yes";
        return 0 ;
    }
    if(s[0][0] == 1 && s[1][1] == 1 && s[2][2] == 1){
        cout << "Yes";
        return 0 ;
    }
    if(s[0][2] == 1 && s[1][1] == 1 && s[2][0] == 1){
        cout << "Yes";
        return 0 ;
    }
    cout << "No";


    return 0;
}

Measured memory_bytes: 256