//Md Fahad
// CSE 18

#include<bits/stdc++.h>


using  namespace  std;

#define PI              acos(-1.0)
#define lcm(a,b)        (a * (b / __gcd(a,b)))
#define en '\n'

#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);
#define Infi                0x3f3f3f3f

const int fx[] = {+1,-1,+0,+0};                         // 4 X directions
const int fy[] = {+0,+0,+1,-1};                         // 4 Y directions
const int fx8[] = {+0,+0,+1,-1,-1,+1,-1,+1};            // King X Moves
const int fy8[] = {-1,+1,+0,+0,+1,+1,-1,-1};            // King Y Moves
const int kx[] = {-2, -2, -1, -1,  1,  1,  2,  2};      // Knight X Moves
const int ky[] = {-1,  1, -2,  2, -2,  2, -1,  1};      // Knight Y Moves



int  Set    (int N,int pos) {return N=N | (1<<pos);}    /// turn a bit on
int  reset  (int N,int pos) {return N= N & ~(1<<pos);}  /// turn a bit off
bool check  (int N,int pos) {return (bool)(N & (1<<pos));} /// check, if a bit is on or not

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif


typedef long long int           ll;
typedef unsigned long long int  llu;

int main(void)
{
    //READ_IN;

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

    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){

            cin >> a[i][j];
        }
    }

    int n;
    cin >> n;

    vector<int> keep(n);

    for(int i=0;i<n;i++){

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

            for(int k=0;k<n;k++){

                if(keep[k]==a[i][j]){
                    a[i][j]=-1;
                }
            }

        }
    }

   


    bool bol = false;

    for(int j=0;j<3;j++){

        if(a[j][0]==-1 && a[j][1]==-1 && a[j][2]==-1)
            bol=true;
    }

     for(int j=0;j<3;j++){

        if(a[0][j]==-1 && a[1][j]==-1 && a[2][j]==-1)
            bol=true;
    }
    if(a[0][0]==-1 && a[1][1]==-1 && a[2][2]==-1)
            bol=true;

            if(a[0][2]==-1 && a[1][1]==-1 && a[2][0]==-1)
            bol=true;

    if(bol){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }






    return 0;
}


Measured memory_bytes: 256