#include <iostream>
#include <vector>

using namespace std;

int main() {
  vector<int> A(9, 0), B(9, 0);
  bool flg = false;
  for(int i = 0; i < 9; i++) cin >> A[i];
  int N; cin >> N;
  for(int i = 0; i < N; i++) {
    int b; cin >> b;
    for(int j = 0; j < 9; j++) {
      if(A[j] == b) B[j] = 1;
    }
  }
  for(int i = 0; i < 3; i++) {
    if(B[i * 3] == 1 && B[i * 3 + 1] == 1 && B[i * 3 + 2] == 1) flg = true;
    if(B[i] == 1 && B[i + 3] == 1 && B[i + 6] == 1) flg = true;
  }
  if(B[0] == 1 && B[4] == 1 && B[8] == 1 || B[2] == 1 && B[4] == 1 && B[6] == 1) flg = true;
  if(flg) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}