#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<int>> bingo(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> bingo.at(i).at(j);
    }
  }
  int N;
  cin >> N;
  vector<int> B(N);
  for (int k = 0; k < N; k++) {
    cin >> B[k];
  }
  for (int l = 0; l < N; l++) {
    for (int m = 0; m < 3; m++) {
      for (int n = 0; n < 3; n++) {
        if (B[l] == bingo.at(m).at(n)) {
          bingo.at(m).at(n) = -1;
        }
      }
    }
  }
  if (bingo[1][1] == bingo[1][2] == bingo[1][3] == -1) {
    cout << "Yes" << endl;
  } else if (bingo[2][1] == bingo[2][2] == bingo[2][3] == -1) {
    cout << "Yes" << endl;
  } else if (bingo[3][1] == bingo[3][2] == bingo[3][3] == -1) {
    cout << "Yes" << endl;
  } else if (bingo[1][1] == bingo[2][1] == bingo[3][1] == -1) {
    cout << "Yes" << endl;
  } else if (bingo[1][2] == bingo[2][2] == bingo[3][2] == -1) {
    cout << "Yes" << endl;
  } else if (bingo[1][3] == bingo[2][3] == bingo[3][3] == -1) {
    cout << "Yes" << endl;
  } else if (bingo[1][1] == bingo[2][2] == bingo[3][3] == -1) {
    cout << "Yes" << endl;
  } else if (bingo[1][3] == bingo[2][2] == bingo[3][1] == -1) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
