#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  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);
    }
  }
  cin >> n;
  vector<int> b(n);
  vector<vector<int>> c(3, vector<int>(3));
  for (int k = 0; k < n; k++) {
    cin >> b.at(k);
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (a.at(i).at(j) == b.at(k)) {
          c.at(i).at(j) = 1;
        }
      }
    }
  }
  s = "No";
  for (int i = 0; i < 3; i++) {
    if ((c.at(i).at(0)) + (c.at(i).at(1)) + (c.at(i).at(2)) == 3) s = "Yes";
  }
  for (int i = 0; i < 3; i++) {
    if ((c.at(0).at(i)) + (c.at(1).at(i)) + (c.at(2).at(i)) == 3) s = "Yes";
  }
  if ((c.at(0).at(0)) + (c.at(1).at(1)) + (c.at(2).at(2)) == 3) s = "Yes";
  if ((c.at(0).at(2)) + (c.at(1).at(1)) + (c.at(2).at(0)) == 3) s = "Yes";
  cout << s << endl;
}
