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


int arr[3][3];
int main()
{

    
    
    int a, b, c, d, e, f, g, h, i;
    cin>>a>>b>>c>>d>>e>>f>>g>>h>>i;
    int n;
    cin>>n;
    vector<bool> bn(101);
    for(int j=0;j<n;j++){
       int t;cin>>t;
       bn[t] = true; 
    }
    bool bingo= (bn[a]&&bn[b]&&bn[c])||(bn[d]&&bn[e]&&bn[f])||
                (bn[g]&&bn[h]&&bn[i])||(bn[a]&&bn[d]&&bn[g])||
                (bn[b]&&bn[e]&&bn[h])||(bn[c]&&bn[f]&&bn[i])||
                (bn[a]&&bn[e]&&bn[i])||(bn[c]&&bn[e]&&bn[g]);
    cout<<(bingo ? "Yes" : "No" ) << endl;
    return 0;
}
