#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
bool compare_by_b(pair<long long, long long> a, pair<long long, long long> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}
const string YES = "Yes";
const string NO = "No";
bool bingo[3][3];
void solve(std::vector<std::vector<long long>> A, long long N,
           std::vector<long long> b) {
  for (int i = (0); i < (3); ++i)
    for (int j = (0); j < (3); ++j) bingo[i][j] = false;
  for (int i = (0); i < (N); ++i) {
    long long sel = b[i];
    for (int i = (0); i < (3); ++i)
      for (int j = (0); j < (3); ++j) {
        if (sel == A[i][j]) {
          bingo[i][j] = true;
        }
      }
  }
  for (int i = (0); i < (3); ++i) {
    if (bingo[i][0] == bingo[i][1] && bingo[i][1] == bingo[i][2]) {
      if (bingo[i][0]) {
        cout << "Yes" << endl;
        return;
      }
    }
  }
  for (int i = (0); i < (3); ++i) {
    if (bingo[0][i] == bingo[1][i] && bingo[1][i] == bingo[2][i]) {
      if (bingo[0][i]) {
        cout << "Yes" << endl;
        return;
      }
    }
  }
  if (bingo[0][0] == bingo[1][1] && bingo[1][1] == bingo[2][2]) {
    if (bingo[0][0]) {
      cout << "Yes" << endl;
      return;
    }
  }
  if (bingo[0][2] == bingo[1][1] && bingo[1][1] == bingo[2][0]) {
    if (bingo[0][2]) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
  return;
}
int main() {
  std::vector<std::vector<long long>> A(3, std::vector<long long>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      scanf("%lld", &A[i][j]);
    }
  }
  long long N;
  scanf("%lld", &N);
  std::vector<long long> b(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &b[i]);
  }
  solve(std::move(A), N, std::move(b));
  return 0;
}
