#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T Abs(T a) {
  return a < 0 ? -a : a;
}
template <typename T>
inline T Max(T a, T b) {
  return a < b ? b : a;
}
template <typename T>
inline T Min(T a, T b) {
  return a > b ? b : a;
}
int main() {
  int temp;
  int sheet[9];
  memset(sheet, -1, 9);
  for (int i = 0; i < 9; i++) {
    cin >> sheet[i];
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    for (int j = 0; j < 9; j++) {
      if (temp == sheet[j]) {
        sheet[j] = 0;
        break;
      }
    }
  }
  bool cek = true;
  for (int i = 0; i < 9; i++) {
    if (sheet[i] != 0) {
      cek = false;
      break;
    }
  }
  if (sheet[0] == sheet[3] == sheet[6] || sheet[0] == sheet[1] == sheet[2] ||
      sheet[0] == sheet[4] == sheet[8] || sheet[1] == sheet[4] == sheet[7] ||
      sheet[3] == sheet[4] == sheet[5] || sheet[6] == sheet[7] == sheet[8] ||
      sheet[2] == sheet[5] == sheet[8] || sheet[2] == sheet[4] == sheet[6] ||
      cek)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
