#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<int>> a(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a.at(i).at(j);
    }
  }
  int N;
  cin >> N;
  vector<int> b(N);
  vector<vector<bool>> count(3, vector<bool>(3, false));
  for (int i = 0; i < N; i++) {
    cin >> b.at(i);
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (b.at(i) == a.at(j).at(k)) count.at(j).at(k) = true;
      }
    }
  }
  bool flag = false;
  for (int i = 0; i < 3; i++) {
    if (count.at(i).at(0) == count.at(i).at(1) == count.at(i).at(2))
      flag = true;
    if (count.at(0).at(i) == count.at(1).at(i) == count.at(2).at(i))
      flag = true;
  }
  if ((count.at(1).at(1) == true) && (count.at(0).at(0) == count.at(2).at(2) ||
                                      count.at(2).at(0) == count.at(0).at(2)))
    flag = true;
  if (flag)
    cout << "Yes";
  else
    cout << "No";
  cout << endl;
  return 0;
}
