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