#include <bits/stdc++.h>
using namespace std;
int main() {
  int bingo[3][3], n, cnt = 0;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> bingo[i][j];
    }
  }
  cin >> n;
  int ara[n];
  for (int i = 0; i < n; i++) {
    cin >> ara[i];
  }
  for (int i = 0; i < n; i++) {
    if ((ara[i] == bingo[0][0]) || (ara[i] == bingo[1][1]) ||
        (ara[i] == bingo[2][2])) {
      cnt++;
    }
  }
  if (cnt >= 3) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
  return 0;
}
