#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[3][3];
  int N, i, j, k, t;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> A[i][j];
    }
  }
  cin >> N;
  int b[N];
  for (i = 0; i < N; i++) {
    cin >> b[i];
  }
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      for (k = 0; k < N; k++) {
        if (A[i][j] == b[k]) {
          A[i][j] = 0;
        }
      }
    }
  }
  for (i = 0; i < 3; i++) {
    if (A[i][1] == 0 && A[i][2] == 0 && A[i][3] == 0) {
      cout << "Yes";
      goto end;
    } else if (A[1][i] == 0 && A[2][i] == 0 && A[3][i] == 0) {
      cout << "Yes";
      goto end;
    }
  }
  if (A[1][1] == 0 && A[2][2] == 0 && A[3][3] == 0) {
    cout << "Yes";
    goto end;
  } else if (A[3][1] == 0 && A[2][2] == 0 && A[1][3] == 0) {
    cout << "Yes";
    goto end;
  }
  cout << "No";
end:;
}
