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