#include <bits/stdc++.h>
using namespace std;
string S[10];
bool checkWin(long long x, long long y, long long dx, long long dy) {
  for (long long i = 0; i < 5; i++) {
    if (x < 0 || x > 9 || y < 0 || y > 9) return 0;
    if (S[x][y] != 'X') return 0;
    x += dx;
    y += dy;
  }
  return 1;
}
long long dX[4] = {1, 0, 1, 1};
long long dY[4] = {0, 1, 1, -1};
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (long long i = 0; i < 10; i++) cin >> S[i];
  for (long long i = 0; i < 10; i++)
    for (long long j = 0; j < 10; j++)
      if (S[i][j] == '.') {
        S[i][j] = 'X';
        for (long long d = 0; d < 4; d++)
          for (long long c = 0; c < 5; c++) {
            if (checkWin(i - dX[d] * c, j - dY[d] * c, dX[d], dY[d]) == 1) {
              cout << "YES";
              return 0;
            }
          }
        S[i][j] = '.';
      }
  cout << "NO";
}
