#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (!a) return b;
  return gcd(b % a, a);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
void sout() { cout << "\n"; }
template <typename T, typename... Types>
void sout(T var1, Types... var2) {
  cout << var1 << " ";
  sout(var2...);
}
template <typename T>
void sout(vector<T> arr) {
  for (auto it : arr) {
    cout << it << " ";
  }
  sout();
}
bool fine(char arr[10][10]) {
  for (long long i = 0; i < 10; i++) {
    for (long long j = 0; j <= 5; j++) {
      long long cnt = 0;
      for (long long k = 0; k < 5; k++) {
        cnt += (arr[i][j + k] == 'X');
      }
      if (cnt == 5) {
        return true;
      }
    }
  }
  for (long long i = 0; i < 6; i++) {
    for (long long j = 0; j < 6; j++) {
      long long cnt = 0;
      for (long long k = j; k < j + 5; k++) {
        cnt += (arr[i][k] == 'X');
      }
      if (cnt == 5) {
        return true;
      }
      cnt = 0;
      for (long long k = i; k < i + 5; k++) {
        cnt += (arr[k][j] == 'X');
      }
      if (cnt == 5) {
        return true;
      }
      cnt = 0;
      for (long long k = 0; k < 5; k++) {
        cnt += (arr[i + k][j + k] == 'X');
      }
      if (cnt == 5) {
        return true;
      }
    }
  }
  for (long long i = 0; i <= 5; i++) {
    for (long long j = 9; j >= 4; j--) {
      long long k = 0;
      long long cnt = 0;
      for (long long k = 0; k < 5; k++) {
        cnt += (arr[i + k][j - k] == 'X');
      }
      if (cnt == 5) {
        return true;
      }
    }
  }
  for (long long i = 0; i <= 5; i++) {
    for (long long j = 0; j <= 9; j++) {
      long long cnt = 0;
      for (long long k = 0; k < 5; k++) {
        cnt += (arr[i + k][j] == 'X');
        if (cnt == 5) {
          return true;
        }
      }
    }
  }
  return false;
}
void test_case() {
  char arr[10][10];
  for (long long i = 0; i < 10; i++) {
    for (long long j = 0; j < 10; j++) {
      cin >> arr[i][j];
    }
  }
  for (long long i = 0; i < 10; i++) {
    for (long long j = 0; j < 10; j++) {
      if (arr[i][j] == '.') {
        arr[i][j] = 'X';
        if (fine(arr)) {
          cout << "YES"
               << "\n";
          ;
          return;
        }
        arr[i][j] = '.';
      }
    }
  }
  cout << "NO"
       << "\n";
  ;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  long long t = 1;
  while (t--) {
    test_case();
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
}
