#include <bits/stdc++.h>
using namespace std;
const int SIZE = 10;
string board[SIZE];
bool horiz() {
  for (int i = 0; i < SIZE; i++) {
    int cntx1 = 0, cntx2 = -5;
    for (int j = 0; j < SIZE; j++) switch (board[i][j]) {
        case 'X':
          cntx1++;
          if (cntx1 + cntx2 + 1 == 5) return true;
          break;
        case 'O':
          cntx1 = 0;
          cntx2 = -5;
          break;
        case '.':
          if (cntx1 + 1 == 5) return true;
          cntx2 = cntx1;
          cntx1 = 0;
      }
  }
  return false;
}
bool vert() {
  for (int j = 0; j < SIZE; j++) {
    int cntx1 = 0, cntx2 = -5;
    for (int i = 0; i < SIZE; i++) switch (board[i][j]) {
        case 'X':
          cntx1++;
          if (cntx1 + cntx2 + 1 == 5) return true;
          break;
        case 'O':
          cntx1 = 0;
          cntx2 = -5;
          break;
        case '.':
          if (cntx1 + 1 == 5) return true;
          cntx2 = cntx1;
          cntx1 = 0;
      }
  }
  return false;
}
bool diag1() {
  for (int delta = -SIZE; delta <= SIZE; delta++) {
    int cntx1 = 0, cntx2 = -5;
    for (int i = 0, j = delta; i < SIZE && j < SIZE; i++, j++)
      if (j >= 0) switch (board[i][j]) {
          case 'X':
            cntx1++;
            if (cntx1 + cntx2 + 1 == 5) return true;
            break;
          case 'O':
            cntx1 = 0;
            cntx2 = -5;
            break;
          case '.':
            if (cntx1 + 1 == 5) return true;
            cntx2 = cntx1;
            cntx1 = 0;
        }
  }
  return false;
}
bool diag2() {
  for (int delta = 0; delta <= 2 * SIZE; delta++) {
    int cntx1 = 0, cntx2 = -5;
    for (int i = 0, j = delta; i < SIZE && j >= 0; i++, j--)
      if (j < SIZE) switch (board[i][j]) {
          case 'X':
            cntx1++;
            if (cntx1 + cntx2 + 1 == 5) return true;
            break;
          case 'O':
            cntx1 = 0;
            cntx2 = -5;
            break;
          case '.':
            if (cntx1 + 1 == 5) return true;
            cntx2 = cntx1;
            cntx1 = 0;
        }
  }
  return false;
}
int main() {
  for (int i = 0; i < SIZE; i++) {
    cin >> ws;
    getline(cin, board[i]);
  }
  if (horiz() || vert() || diag1() || diag2())
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
