#include<iostream>
using namespace std;

int main() {
  int A[9], marked;
  marked = 0;
  for (int i = 0; i < 9; i++) cin >> A[i];
  int N, b; cin >> N;
  for (int j = 0; j < N; j++) {
    cin >> b;
    for (int i = 0; i < 9; i++) {
      if (A[i] == b) marked |= (1<<i);
    }
  }
  int bingos[] = {0b000000111, 0b000111000,
                  0b111000000, 0b001001001,
                  0b010010010, 0b100100100,
                  0b100010001, 0b001010100};
  bool res = false;
  for (int i = 0; i < 8; i++) {
    if ((marked | bingos[i]) == marked) res = true;
  }
  if (res) cout << "Yes" << endl;
  else cout << "No" << endl;
}