#include <bits/stdc++.h>
using namespace std;
string m[10];
bool win(int i, int j, int x, int y) {
  int X = 0;
  int O = 0;
  int D = 0;
  for (int c = 0; c < 5 && i >= 0 && i < 10 && j >= 0 && j < 10;
       i += x, j += y, c++) {
    if (m[i][j] == 'X') {
      X++;
    } else if (m[i][j] == 'O') {
      O++;
    } else {
      D++;
    }
  }
  return X == 4 && D == 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  for (int i = 0; i < 10; i++) {
    cin >> m[i];
  }
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      if (m[i][j] == 'X') {
        for (int kx = -1; kx < 2; kx++) {
          for (int ky = -1; ky < 2; ky++) {
            if (kx == 0 && ky == 0) continue;
            if (win(i, j, kx, ky)) {
              cout << "YES";
              return 0;
            }
          }
        }
      }
    }
  }
  cout << "NO";
  return 0;
}
