#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(9);
  for(int i=0;i<9;i++)
    cin>>a.at(i);
  vector<bool> c={0,0,0,0,0,0,0,0,0};
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    int b;
    cin>>b;
    for(int ia=0;ia<9;ia++)
      if(b==a.at(ia))
        c.at(ia)=1;
  }
  bool bc=0;
  for(int i=0;i<3;i++)
    if((c.at(i)&&c.at(3+i)&&c.at(6+i))||(c.at(3*i)&&c.at(3*i+1)&&c.at(3*i+2)))
      bc=1;
  if((c.at(0)&&c.at(4)&&c.at(8))||(c.at(2)&&c.at(4)&&c.at(6)))
    bc=1;
  cout<<(bc?"Yes":"No")<<endl;
}