#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<int>> A(3, vector<int>(3, 0));
  int N;
  vector<int> B(N, 0);
  string Ans = "No";
  for (int i = 0; i < (int)(3); i++) {
    for (int j = 0; j < (int)(3); j++) {
      cin >> A.at(i).at(j);
    }
  }
  cin >> N;
  for (int k = 0; k < (int)(N); k++) {
    cin >> B.at(k);
    for (int i = 0; i < (int)(3); i++) {
      for (int j = 0; j < (int)(3); j++) {
        if (A.at(i).at(j) == B.at(k)) {
          A.at(i).at(j) = 1000;
          if (A.at(0).at(j) == 1000 && A.at(1).at(j) == 1000 &&
              A.at(2).at(j) == 1000) {
            Ans = "Yes";
            break;
          }
          if (A.at(i).at(0) == 1000 && A.at(i).at(1) == 1000 &&
              A.at(i).at(2) == 1000) {
            Ans = "Yes";
            break;
          }
          if (A.at(0).at(0) == 1000 && A.at(1).at(1) == 1000 &&
              A.at(2).at(2) == 1000) {
            Ans = "Yes";
            break;
          }
          if (A.at(0).at(2) == 1000 && A.at(1).at(1) == 1000 &&
              A.at(2).at(0) == 1000) {
            Ans = "Yes";
            break;
          }
        }
      }
      if (Ans == "Yes") {
        break;
      }
    }
  }
  cout << Ans << endl;
}
