#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[3][3] = {0};
  int N;
  for (int i = 0; i < 3; i++) {
    cin >> A[i][0] >> A[i][1] >> A[i][2];
  }
  cin >> N;
  int b[N];
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }
  int B[3][3] = {0};
  bool res = false;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < N; k++) {
        if (A[i][j] == b[k]) {
          B[i][j] = b[k];
        }
      }
    }
  }
  for (int i = 0; i < 3; i++) {
    if (B[0][i] * B[1][i] * B[2][i] != 0) {
      res = true;
    }
  }
  for (int i = 0; i < 3; i++) {
    if (B[i][0] * B[i][1] * B[i][2] != 0) {
      res = true;
    }
  }
  if (B[0][0] * B[1][1] * B[2][2] != 0) {
    res = true;
  }
  if (B[0][2] * B[1][1] * B[2][0] != 0) {
    res = true;
  }
  if (res == true) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
