#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const long long INF = 1e18;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int M[10][10];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> M[i][j];
    }
  }
  cout << M[2][2] << endl;
  int n;
  cin >> n;
  int N[11];
  for (int i = 0; i < n; i++) {
    cin >> N[i];
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < n; k++) {
        if (N[k] == M[i][j]) {
          M[i][j] = -1;
        }
      }
    }
  }
  for (int i = 0; i < 3; i++) {
    if (M[i][1] == M[i][2] && M[i][2] == M[i][0] && M[i][0] == -1) {
      cout << "Yes" << endl;
      return 0;
    }
    if (M[1][i] == M[2][i] && M[0][i] == M[1][i] && M[0][i] == -1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (M[0][0] == -1 && M[1][1] == -1 && M[2][2] == -1) {
    cout << "Yes" << endl;
    return 0;
  }
  if (M[0][2] == -1 && M[1][1] == -1 && M[2][0] == -1) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}
