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