#include <bits/stdc++.h>
using namespace std;
char incrementChar(char x) { return static_cast<char>(x + 1); }
int main() {
  vector<int> v;
  int i;
  int A;
  for (i = 0; i < 9; i++) {
    cin >> A;
    v.push_back(A);
  }
  int bingo[9];
  for (i = 0; i < 9; i++) bingo[i] = 0;
  int N;
  cin >> N;
  int b;
  for (i = 0; i < N; i++) {
    cin >> b;
    for (int j = 0; j < 9; j++) {
      if (b == v[j]) bingo[j] = 1;
    }
  }
  int sum = 0;
  if (bingo[0] + bingo[1] + bingo[2] == 3) sum++;
  if (bingo[3] + bingo[4] + bingo[5] == 3) sum++;
  if (bingo[6] + bingo[7] + bingo[8] == 3) sum++;
  if (bingo[0] + bingo[3] + bingo[6] == 3) sum++;
  if (bingo[1] + bingo[4] + bingo[7] == 3) sum++;
  if (bingo[2] + bingo[5] + bingo[8] == 3) sum++;
  if (bingo[0] + bingo[4] + bingo[8] == 3) sum++;
  if (bingo[2] + bingo[4] + bingo[6] == 3) sum++;
  if (sum > 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
