#include <bits/stdc++.h>
int main() {
  int n, k, ctr = 0;
  int arr[4][4], arr2[4][4];
  for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) {
      scanf("%d", &arr[i][j]);
    }
  }
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &k);
    for (int j = 1; j <= 3; j++) {
      for (int z = 1; z <= 3; z++) {
        if (arr[j][z] == k) {
          arr[j][z] == 0;
        }
      }
    }
  }
  for (int i = 1; i <= 3; i++) {
    if (arr[i][1] + arr[i][2] + arr[i][3] == 0) {
      ctr++;
    }
    if (arr[1][i] + arr[2][i] + arr[3][i] == 0) {
      ctr++;
    }
  }
  if (arr[1][1] + arr[2][2] + arr[3][3] == 0) {
    ctr++;
  }
  if (arr[1][3] + arr[2][2] + arr[3][1] == 0) {
    ctr++;
  }
  if (ctr >= 1) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}
