#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

const string YES = "Yes";
const string NO = "No";

bool bingo[3][3];

void solve(std::vector<std::vector<long long>> A, long long N, std::vector<long long> b){
    REP(i,3)REP(j,3)bingo[i][j] =false;

    REP(i, N){
        LL sel = b[i];
        REP(i,3)REP(j,3){
            if(sel == A[i][j]){
                bingo[i][j]=true;
            }
        }
    }
    REP(i,3){
            if(bingo[i][0]==bingo[i][1] && bingo[i][1]==bingo[i][2]){
                if(bingo[i][0]){cout<<"Yes"<<endl;
                return;}
            }
    }
    REP(i,3){
            if(bingo[0][i]==bingo[1][i] && bingo[1][i]==bingo[2][i]){
                if(bingo[0][i]){cout<<"Yes"<<endl;
                return;}
            }
    }
    if(bingo[0][0]==bingo[1][1] &&bingo[1][1]==bingo[2][2]){
        if(bingo[0][0]){cout<<"Yes"<<endl;return;}
    }
    if(bingo[0][2]==bingo[1][1] && bingo[1][1]==bingo[2][0]){
        if(bingo[0][2]){cout<<"Yes"<<endl;return;}
    }
    cout<<"No"<<endl;
    return;
}

int main(){
    std::vector<std::vector<long long>> A(3, std::vector<long long>(3));
    for(int i = 0 ; i < 3 ; i++){
        for(int j = 0 ; j < 3 ; j++){
            scanf("%lld",&A[i][j]);
        }
    }
    long long N;
    scanf("%lld",&N);
    std::vector<long long> b(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&b[i]);
    }
    solve(std::move(A), N, std::move(b));
    return 0;
}


Measured memory_bytes: 256