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

#define REP(i,n) for(int i=0;i<n;i++)
int a[3][3];
template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
signed main(){
  REP(i,3)REP(j,3)cin>>a[i][j];
  int n;cin>>n;
  while(n--){
    int s;cin>>s;
    REP(i,3)REP(j,3)if(a[i][j]==s)a[i][j]=0;
  }
  REP(i,3){
    int c=0;
    REP(j,3)c+=a[i][j];
    if(!c)fin("Yes");
  }
  //コピペを3回していい感じにする
  REP(i,3){
    int c=0;
    REP(j,3)c+=a[j][i];
    if(!c)fin("Yes");
  }
  REP(i,3){
    int c=0;
    REP(j,3)c+=a[j][j];
    if(!c)fin("Yes");
  }
  REP(i,3){
    int c=0;
    REP(j,3)c+=a[2-j][j];
    if(!c)fin("Yes");
  }
  fin("No");
}
