#include <iostream>
#include <stdio.h>

#define rep(i,min,sup) for(int i=min;i<sup;i++)
#define per(i,min,sup) for(int i=(sup-1);i>=min;i--)
#define swap(a,b) {a+=b;b=a-b;a-=b;}
#define ll long long

using namespace std;

int main(){
  int A[9];
  rep(i,0,9)scanf("%d",&A[i]);
  int N,b,c=0;
  scanf("%d",&N);
  rep(i,0,N){
    scanf("%d",&b);
    rep(j,0,9)if(b==A[j])c+=1<<j;
  }
  int bingo[8]={0b100100100,0b010010010,0b001001001,0b111000000,
                0b000111000,0b000000111,0b100010001,0b001010100};
  rep(i,0,8){
    if(bingo[i]==(bingo[i]&c)){
      printf("Yes");return 0;
    }
  }
  printf("No");
}