#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int N = 50009;
long long a[10][10];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  char k;
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> k;
      if (k == 'X')
        a[i][j] = 1;
      else if (k == 'O')
        a[i][j] = -1e9;
    }
  }
  for (int i = 0; i < 10; i++) {
    for (int 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) {
        cout << "YES\n";
        return 0;
      }
    }
  }
  for (int i = 0; i < 6; i++) {
    for (int 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) {
        cout << "YES\n";
        return 0;
      }
    }
  }
  for (int i = 0; i < 6; i++) {
    for (int 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) {
        cout << "YES\n";
        return 0;
      }
    }
  }
  for (int i = 0; i < 6; i++) {
    for (int 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) {
        cout << "YES\n";
        return 0;
      }
    }
  }
  cout << "NO\n";
  return 0;
}
