#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int a[3][3];
  int d[3][3];
  for (int i = 0; i < (3); ++i)
    for (int j = 0; j < (3); ++j) {
      cin >> a[i][j];
      d[i][j] = 0;
    }
  int n;
  cin >> n;
  int b[100];
  for (int k = 0; k < (n); ++k) {
    cin >> b[k];
    for (int i = 0; i < (3); ++i)
      for (int j = 0; j < (3); ++j)
        if (a[i][j] == b[k]) d[i][j] = 1;
  }
  if (d[0][0] == 1 && d[0][1] == 1 && d[0][2] == 1) {
    cout << "Yes\n";
    return 0;
  }
  if (d[1][0] == 1 && d[1][1] == 1 && d[1][2] == 1) {
    cout << "Yes\n";
    return 0;
  }
  if (d[2][0] == 1 && d[2][1] == 1 && d[2][2] == 1) {
    cout << "Yes\n";
    return 0;
  }
  if (d[0][0] == 1 && d[1][0] == 1 && d[2][0] == 1) {
    cout << "Yes\n";
    return 0;
  }
  if (d[0][1] == 1 && d[1][1] == 1 && d[2][1] == 1) {
    cout << "Yes\n";
    return 0;
  }
  if (d[0][2] == 1 && d[1][2] == 1 && d[2][2] == 1) {
    cout << "Yes\n";
    return 0;
  }
  if (d[0][0] == 1 && d[1][1] == 1 && d[2][2] == 1) {
    cout << "Yes\n";
    return 0;
  }
  if (d[0][2] == 1 && d[1][1] == 1 && d[2][0] == 1) {
    cout << "Yes\n";
    return 0;
  }
  cout << "No\n";
  return 0;
}
