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