#include <bits/stdc++.h>
int main() {
  int i, j, a[10][10] = {0};
  char ch;
  for (i = 0; i < 10; i++) {
    for (j = 0; j < 10; j++) {
      ch = getchar();
      if (ch == 'X') a[i][j] = 1;
      if (ch == 'O') a[i][j] = -1;
    }
    ch = getchar();
  }
  for (i = 0; i < 10; i++) {
    for (j = 0; j < 6; j++) {
      if (a[i][j] + a[i][j + 1] + a[i][j + 2] + a[i][j + 3] + a[i][j + 4] ==
          4) {
        printf("Yes\n");
        return 0;
      }
    }
  }
  for (i = 0; i < 6; i++) {
    for (j = 0; j < 10; j++) {
      if (a[i][j] + a[i + 1][j] + a[i + 2][j] + a[i + 3][j] + a[i + 4][j] ==
          4) {
        printf("Yes\n");
        return 0;
      }
    }
  }
  for (i = 0; i < 6; i++) {
    for (j = 0; j < 6; j++) {
      if (a[i][j] + a[i + 1][j + 1] + a[i + 2][j + 2] + a[i + 3][j + 3] +
              a[i + 4][j + 4] ==
          4) {
        printf("Yes\n");
        return 0;
      }
    }
  }
  for (i = 0; i < 6; i++) {
    for (j = 4; j < 10; j++) {
      if (a[i][j] + a[i + 1][j - 1] + a[i + 2][j - 2] + a[i + 3][j - 3] +
              a[i + 4][j - 4] ==
          4) {
        printf("Yes\n");
        return 0;
      }
    }
  }
  printf("No\n");
  return 0;
}
