#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int A[3][3];
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> A[i][j];
    }
  }
  cin >> N;
  int b[N];
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }
  for (int k = 0; k < N; k++) {
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (b[k] == A[i][j]) {
          A[i][j] = 0;
        }
      }
    }
  }
  string ANS = "No";
  for (int i = 0; i < 3; i++) {
    if (A[i][0] == 0 and A[i][1] == 0 and A[i][2] == 0) {
      ANS = "Yes";
    }
  }
  for (int i = 0; i < 3; i++) {
    if (A[0][i] == 0 and A[1][i] == 0 and A[2][i] == 0) {
      ANS = "Yes";
    }
  }
  if (A[0][0] == 0 and A[1][1] == 0 and A[2][2] == 0) {
    ANS = "Yes";
  }
  if (A[0][2] == 0 and A[1][1] == 0 and A[2][0] == 0) {
    ANS = "Yes";
  }
  cout << ANS << endl;
  return 0;
}
