#include <bits/stdc++.h>
int main() {
  int arr[3][3];
  for (int i = 0; i < 3; ++i)
    for (int j = 0; j < 3; ++j) std::cin >> arr[i][j];
  int n;
  std::cin >> n;
  int nrr[n];
  for (int i = 0; i < n; ++i) std::cin >> nrr[i];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 3; ++k) {
        if (nrr[i] == arr[j][k]) arr[j][k] = 0;
      }
    }
  }
  bool flag = false;
  if (arr[1][1] == 0) {
    if ((arr[0][0] == 0 && arr[2][2] == 0) ||
        (arr[0][1] == 0 && arr[2][1] == 0) ||
        (arr[2][0] == 0 && arr[0][2] == 0) ||
        (arr[1][0] == 0 && arr[1][2] == 0)) {
      flag = true;
      std::cout << "Yes\n";
    }
  } else if (arr[0][0] == 0) {
    if ((arr[1][0] == 0 && arr[2][0] == 0) ||
        (arr[0][1] == 0 && arr[0][2] == 0)) {
      flag = true;
      std::cout << "Yes\n";
    }
  } else if (arr[2][2] == 0) {
    if ((arr[2][0] == 0 && arr[2][1] == 0) ||
        (arr[1][2] == 0 && arr[0][2] == 0)) {
      flag = true;
      std::cout << "Yes\n";
    }
  }
  if (!flag) std::cout << "No\n";
}
