#include <bits/stdc++.h>
int main(void) {
  int N;
  int i, j, k;
  int bingo[3][3];
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      bingo[i][j] = 0;
    }
  }
  int Aar[3][3];
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      scanf("%d", &Aar[i][j]);
    }
  }
  scanf("%d", &N);
  int bar[N];
  for (k = 0; k < N; k++) {
    scanf("%d", &bar[k]);
  }
  for (k = 0; k < N; k++) {
    for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
        if (Aar[i][j] == bar[k]) {
          bingo[i][j] = 1;
        }
      }
    }
  }
  k = 0;
  for (i = 0; i < 3; i++) {
    k += bingo[i][0] * bingo[i][1] * bingo[i][2];
    k += bingo[0][i] * bingo[1][i] * bingo[2][i];
  }
  k += bingo[0][0] * bingo[1][1] * bingo[2][2];
  k += bingo[0][2] * bingo[1][1] * bingo[2][0];
  if (k == 0) {
    printf("No");
  } else {
    printf("Yes");
  }
  return 0;
}
