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