#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<int>> data(3, vector<int>(3));
  int n;
  string ans;
  vector<int> v(10);
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> data.at(i).at(j);
    }
  }
  cin >> n;
  for (int k = 0; k < n; k++) {
    cin >> v.at(k);
  }
  int m = 0;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if (v.at(m) == data.at(i).at(j)) {
        data.at(i).at(j) = 0;
        ++m;
        if (m == n) {
          break;
        }
      }
    }
  }
  if (data.at(0).at(0) + data.at(0).at(1) + data.at(0).at(2) == 0 ||
      data.at(1).at(0) + data.at(1).at(1) + data.at(1).at(2) == 0 ||
      data.at(2).at(0) + data.at(2).at(1) + data.at(2).at(2) == 0 ||
      data.at(0).at(0) + data.at(1).at(0) + data.at(2).at(0) == 0 ||
      data.at(0).at(1) + data.at(1).at(1) + data.at(2).at(1) == 0 ||
      data.at(0).at(2) + data.at(1).at(2) + data.at(2).at(2) == 0 ||
      data.at(0).at(0) + data.at(1).at(1) + data.at(2).at(2) == 0 ||
      data.at(0).at(2) + data.at(1).at(1) + data.at(2).at(0) == 0) {
    ans = "Yes";
  } else {
    ans = "No";
  }
  cout << ans << endl;
}
