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