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