#include <bits/stdc++.h>
using namespace std;
string s;
vector<string> t;
int dx[4] = {0, 1, 1, 1};
int dy[4] = {1, 0, 1, -1};
int main() {
  ios_base::sync_with_stdio(false);
  t.assign(20, string(20, 'O'));
  for (int i = 0; i < 10; ++i) {
    cin >> s;
    for (int j = 0; j < 10; ++j) t[i + 5][j + 5] = s[j];
  }
  for (int i = 5; i < 15; ++i) {
    for (int j = 5; j < 15; ++j) {
      for (int k = 0; k < 4; ++k) {
        int x = dx[k];
        int y = dy[k];
        map<char, int> ma;
        for (int l = 0; l < 5; ++l) ++ma[t[i + l * x][j + l * y]];
        if (ma['X'] == 4 && ma['.'] == 1) {
          cout << "YES\n";
          return 0;
        }
      }
    }
  }
  cout << "NO\n";
  return 0;
}
