#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, N;
  int bing0[3][3];
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      cin >> bing0[i][j];
    }
  }
  cin >> N;
  int arr[N], status;
  for (i = 0; i < N; i++) {
    cin >> arr[i];
  }
  int temp[18], count = 0, k;
  for (i = 0; i < N; i++) {
    status = 0;
    j = 0;
    while (j < 3 && status == 0) {
      k = 0;
      while (k < 3 && status == 0) {
        if (arr[i] == bing0[j][k]) {
          temp[count] = j;
          temp[count + 1] = k;
          count += 2;
          status = 1;
        }
        k++;
      }
      j++;
    }
  }
  i = 0;
  int diag = 0, kolom = 0;
  while (i < count) {
    if (temp[i] == temp[i + 1] || (temp[i] == 0 && temp[i + 1] == 2) ||
        (temp[i] == 2 && temp[i + 1] == 0)) {
      diag++;
    } else if (temp[i + 1] != temp[i]) {
      kolom++;
    }
    i += 2;
  }
  if (diag >= 3 || kolom >= 3) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}
