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

int main(){
  vector<int> b;
  for(int i=0; i<9; i++){
	int val;
    cin >> val;
    b.push_back(val);
  }
    
  int N; cin >> N;
  for(int i = 0; i<N; i++) {
    int val;  
    cin >> val;
    
    for(int j = 0; j<9; j++){
        if(b[j] == val) b[j]=0;
    }
  }
  
  int ans[8][3] = {{0,1,2}, {3,4,5}, {6,7,8}, {0,3,6}, {1,4,7}, {2,5,8}, {0,4,8}, {2,4,6}};
  for(int i = 0; i<8; i++){
      if(b[ans[i][0]]+b[ans[i][1]]+b[ans[i][2]] == 0) {
          cout << "Yes";
          return 0;
      }
  }
  
  cout << "No";
  return 0;
}
