#include <bits/stdc++.h>
using namespace std;
int a[11][11];
int check(int i, int j) {
  int st[5] = {0}, d1, d2;
  for (int p = i, sum = 0; p < i + 5; p++, sum = 0) {
    for (int q = j; q < j + 5; q++) {
      st[q - j] += a[p][q];
      sum += a[p][q];
    }
    if (sum == 4) return 1;
  }
  d1 = a[i][j] + a[i + 1][j + 1] + a[i + 2][j + 2] + a[i + 3][j + 3] +
       a[i + 4][j + 4];
  d2 = a[i + 4][j] + a[i + 3][j + 1] + a[i + 2][j + 2] + a[i + 1][j + 3] +
       a[i][j + 4];
  if (st[0] == 4 || st[1] == 4 || st[2] == 4 || st[3] == 4 || st[4] == 4 ||
      d1 == 4 || d2 == 4)
    return 1;
  return 0;
}
int main() {
  char ch;
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++) {
      cin >> ch;
      switch (ch) {
        case 'X':
          a[i][j] = 1;
          break;
        case '.':
          a[i][j] = 0;
          break;
        case 'O':
          a[i][j] = -1;
          break;
      }
    }
  for (int i = 0; i < 6; i++)
    for (int j = 0; j < 6; j++) {
      if (check(i, j)) return cout << "YES", 0;
    }
  return cout << "NO", 0;
}
