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