#include <bits/stdc++.h>
using namespace std;
void update(int mat[3][3], int x) {
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if (mat[i][j] == x) {
        mat[i][j] = -1;
        return;
      }
    }
  }
}
int main() {
  int a[3][3];
  int n, x;
  bool ans = false;
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) cin >> a[i][j];
  cin >> n;
  while (n--) {
    cin >> x;
    update(a, x);
    if (!ans) {
      int cont = 0;
      for (int i = 0, j = 0; i < 3; i++, j++) cont += (a[i][j] == -1);
      if (cont == 3) ans = true;
      for (int i = 0; i < 3; i++) {
        cont = 0;
        for (int j = 0; j < 3; j++) {
          cont += (a[i][j] == -1);
        }
        if (cont == 3) {
          ans = true;
          i = 20;
        }
      }
      for (int j = 0; j < 3; j++) {
        cont = 0;
        for (int i = 0; i < 3; i++) {
          cont += (a[i][j] == -1);
        }
        if (cont == 3) {
          ans = true;
          j = 20;
        }
      }
      if (!ans)
        ans = (a[0][2] == a[1][1] && a[0][2] == a[2][0] && a[0][2] == -1);
    }
  }
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}
