#include <bits/stdc++.h>
int main() {
  int n, s, i, j, k;
  int a[3][3];
  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", &s);
    for (i = 0; i < 3; i++)
      for (j = 0; j < 3; j++) {
        if (s == a[i][j]) a[i][j] = 0;
      }
  }
  if (a[0][0] + a[1][1] + a[2][2] == 0)
    printf("YES");
  else if (a[0][2] + a[1][1] + a[2][0] == 0)
    printf("YES");
  else if (a[0][0] + a[0][1] + a[0][2] == 0)
    printf("YES");
  else if (a[1][0] + a[1][1] + a[1][2] == 0)
    printf("YES");
  else if (a[2][0] + a[2][1] + a[2][2] == 0)
    printf("YES");
  else if (a[0][0] + a[1][0] + a[2][0] == 0)
    printf("YES");
  else if (a[0][1] + a[1][1] + a[2][1] == 0)
    printf("YES");
  else if (a[0][2] + a[1][2] + a[2][2] == 0)
    printf("YES");
  else
    printf("NO");
}
