#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[101][101];
  cin >> a[1][1];
  cin >> a[1][2];
  cin >> a[1][3];
  cin >> a[2][1];
  cin >> a[2][2];
  cin >> a[2][3];
  cin >> a[3][1];
  cin >> a[3][2];
  cin >> a[3][3];
  int n;
  cin >> n;
  int b[101];
  int c[101];
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) {
      for (int ji = 1; ji <= n; ji++) {
        if (a[i][j] == b[ji]) {
          c[i * (i - 1) + j] = 1;
        }
      }
    }
  }
  if (c[1] == c[2] == c[3] == 1) {
    cout << "Yes";
    return 0;
  }
  if (c[4] == c[5] == c[6] == 1) {
    cout << "Yes";
    return 0;
  }
  if (c[7] == c[8] == c[9] == 1) {
    cout << "Yes";
    return 0;
  }
  if (c[1] == c[4] == c[7] == 1) {
    cout << "Yes";
    return 0;
  }
  if (c[2] == c[5] == c[8] == 1) {
    cout << "Yes";
    return 0;
  }
  if (c[3] == c[6] == c[9] == 1) {
    cout << "Yes";
    return 0;
  }
  if (c[1] == c[5] == c[9] == 1) {
    cout << "Yes";
    return 0;
  }
  if (c[3] == c[5] == c[7] == 1) {
    cout << "Yes";
    return 0;
  }
  cout << "No";
  return 0;
}
