#include <bits/stdc++.h>
typedef struct {
  int number;
  int flag;
} bingo;
int judge(bingo A[3][3], int b[]) {
  int result = 0;
  int val_1 = 1;
  int val_2 = 1;
  int val_3 = 1;
  int val_4 = 1;
  int i, j;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      val_1 *= A[i][j].flag;
      val_2 *= A[j][i].flag;
    }
    val_3 *= A[i][i].flag;
    val_4 *= A[2 - i][i].flag;
    result += val_1 + val_2 + val_3 + val_4;
  }
  if (result > 0) {
    return 1;
  } else {
    return 0;
  }
}
int main(void) {
  int N;
  int i, j, k;
  bingo A[3][3];
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      scanf("%d", &A[i][j].number);
    }
  }
  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++) {
      A[i][j].flag = 0;
    }
  }
  for (k = 0; k < N; k++) {
  }
  for (k = 0; k < N; k++) {
    for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
        if (b[k] == A[i][j].number) {
          A[i][j].flag = 1;
        }
      }
    }
  }
  if (judge(A, b) == 1) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}
