#include <bits/stdc++.h>
int main(void) {
  std::vector<std::vector<int>> card(3, std::vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      std::cin >> card.at(i).at(j);
    }
  }
  int N = 0;
  std::cin >> N;
  std::vector<int> number(N);
  for (int i = 0; i < N; i++) {
    std::cin >> number[i];
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < N; k++) {
        if (number[k] == card.at(i).at(j)) {
          card.at(i).at(j) = 0;
        }
      }
    }
  }
  bool answer = false;
  for (int i = 0; i < 3; i++) {
    if (card.at(i).at(0) == 0 && card.at(i).at(1) == 0 &&
        card.at(i).at(2) == 0) {
      answer = true;
    }
    if (card.at(0).at(i) == 0 && card.at(1).at(i) == 0 &&
        card.at(2).at(i) == 0) {
      answer = true;
    }
    if (card.at(0).at(0) == 0 && card.at(1).at(1) == 0 &&
        card.at(2).at(2) == 0) {
      answer = true;
    }
    if (card.at(2).at(0) == 0 && card.at(1).at(1) == 0 &&
        card.at(0).at(2) == 0) {
      answer = true;
    }
  }
  if (answer == true) {
    std::cout << "Yes";
  } else {
    std::cout << "No";
  }
  return 0;
}
