#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[3][3];
  int c[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
      c[i][j] = 0;
    }
  }
  int N;
  cin >> N;
  int b;
  for (int k = 0; k < N; k++) {
    cin >> b;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (b == a[i][j]) {
          c[i][j] = 1;
        }
      }
    }
  }
  for (int i = 0; i < 3; i++) {
    if ((a[i][0] + a[i][1] + a[i][2]) == 3) {
      cout << "Yes" << endl;
      break;
    } else if ((a[0][i] + a[1][i] + a[2][i]) == 3) {
      cout << "Yes" << endl;
      break;
    }
  }
  if ((a[0][0] + a[1][1] + a[2][2]) == 3) {
    cout << "Yes" << endl;
  } else if ((a[0][2] + a[1][1] + a[2][0]) == 3) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
