#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<int>> A(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> A[i][j];
    }
  }
  int N;
  cin >> N;
  vector<int> b(N);
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      for (int l = 0; l < 3; l++) {
        if (b[i] == A[j][l]) {
          A[j][l] = true;
        } else {
          A[j][l] = false;
        }
      }
    }
  }
  string ans = "No";
  if (A[0][0] and A[1][1] and A[2][2]) {
    ans = "Yes";
  }
  if (A[0][2] and A[1][1] and A[2][0]) {
    ans = "Yes";
  }
  for (int i = 0; i < 3; i++) {
    if (A[0][i] and A[0][i] and A[0][i]) {
      ans = "Yes";
    }
    if (A[i][0] and A[i][0] and A[i][0]) {
      ans = "Yes";
    }
  }
  cout << ans << endl;
}
