#include <bits/stdc++.h>
using namespace std;
bool ans[3][3];
int main() {
  int num, N;
  map<int, pair<int, int> > m;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> num;
      m.insert(make_pair(num, make_pair(i, j)));
    }
  }
  int b;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> b;
    if (m.count(b)) {
      ans[m[b].first][m[b].second] = 1;
    }
  }
  for (int i = 0; i < 3; i++) {
    int sum = ans[i][0] + ans[i][1] + ans[i][2];
    if (sum == 3) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  for (int i = 0; i < 3; i++) {
    int sum = ans[0][i] + ans[1][i] + ans[2][i];
    if (sum == 3) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  int sum = ans[0][0] + ans[1][1] + ans[2][2];
  if (sum == 3) {
    cout << "Yes" << endl;
    return 0;
  }
  sum = ans[0][2] + ans[1][1] + ans[2][0];
  if (sum == 3) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}
