#include <bits/stdc++.h>
int main() {
  int array[3][3];
  int i, j;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      scanf("%d", &array[i][j]);
    }
  }
  int n, num, k;
  scanf("%d", &n);
  for (k = 0; k < n; k++) {
    scanf("%d", &num);
    for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
        if (num == array[i][j]) {
          array[i][j] = 0;
        }
      }
    }
  }
  int judge = 0;
  for (i = 0; i < 3; i++) {
    if ((array[i][0] == 0) && (array[i][1] == 0) && (array[i][2])) {
      judge = 1;
      break;
    }
  }
  if (judge == 0) {
    for (i = 0; i < 3; i++) {
      if ((array[0][i] == 0) && (array[1][i] == 0) && (array[2][i] == 0)) {
        judge = 1;
        break;
      }
    }
  }
  if (judge == 0) {
    if ((array[0][0] == 0) && (array[1][1] == 0) && (array[2][2] == 0)) {
      judge = 1;
    }
  }
  if (judge == 0) {
    if ((array[0][2] == 0) && (array[1][1] == 0) && (array[2][0] == 0)) {
      judge = 1;
    }
  }
  if (judge == 1) {
    printf("Yes");
  } else {
    printf("No");
  }
  return 0;
}
