#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i< (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(){
    vector<int> a(9);
    rep(i,9) cin >> a[i];
    int n;
    cin >> n;
    rep(i,n){
        int b;
        cin >> b;
        rep(j,9){
            if(a[j]==b) a[j] = 0;
        }
    }
    if(a[0]+a[1]+a[2]==0 || a[3]+a[4]+a[5]==0 || a[6]+a[7]+a[8]==0 ||
       a[0]+a[3]+a[6]==0 || a[1]+a[4]+a[7]==0 || a[2]+a[5]+a[8]==0 ||
       a[0]+a[4]+a[8]==0 || a[2]+a[4]+a[6]==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}
