#include <bits/stdc++.h>
using ll = long long;
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
int main() {
  vvi bingo(3, vi(3));
  vvi che(3, vi(3));
  for (int i = 0; i < (int)(3); i++) {
    for (int j = 0; j < (int)(3); j++) {
      cin >> bingo[i][j];
      che[i][j] = 0;
    }
  }
  int n;
  cin >> n;
  for (int i = 0; i < (int)(3); i++) {
    for (int j = 0; j < (int)(3); j++) {
      for (int k = 0; k < (int)(n); k++) {
        int b;
        cin >> b;
        if (bingo[i][j] == b) {
          che[i][j] = 1;
        }
      }
    }
  }
  for (int i = 0; i < (int)(3); i++) {
    if (che[i][1] == che[i][2] == che[i][0] == 1 ||
        che[0][i] == che[1][i] == che[2][i] == 1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (che[0][0] == che[1][1] == che[2][2] == 1 ||
      che[0][2] == che[1][1] == che[2][0] == 1) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}
