#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define test int _; cin >> _; while (_--)
#define mod 1000000007
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int a[10][10];
pair<int,int> up(int ii, int jj){
int x=0,space=0;
for(int i=ii-1;i>=0;i--){
if(a[i][jj] == 'X') x++;
else{
if(a[i][jj] == '.') space++;
break;
}
}
return {x,space};
}
pair<int,int> down(int ii, int jj){
int x=0,space=0;
for(int i=ii+1;i<10;i++){
if(a[i][jj] == 'X') x++;
else{
if(a[i][jj] == '.') space++;
break;
}
}
return {x,space};
}
pair<int,int> left(int ii, int jj){
int x=0,space=0;
for(int j=jj-1;j>=0;j--){
if(a[ii][j] == 'X') x++;
else{
if(a[ii][j] == '.') space++;
break;
}
}
return {x,space};
}
pair<int,int> right(int ii, int jj){
int x=0,space=0;
for(int j=jj+1;j<10;j++){
if(a[ii][j] == 'X') x++;
else{
if(a[ii][j] == '.') space++;
break;
}
}
return {x,space};
}
pair<int,int> upright(int ii, int jj){
int x=0,space=0;
int i=ii-1,j=jj+1;
while(i>=0 && j<10){
if(a[i][j] == 'X') x++;
else{
if(a[i][j] == '.') space++;
break;
}
i--;
j++;
}
return {x,space};
}
pair<int,int> upleft(int ii, int jj){
int x=0,space=0;
int i=ii-1,j=jj-1;
while(i>=0 && j>=0){
if(a[i][j] == 'X') x++;
else{
if(a[i][j] == '.') space++;
break;
}
i--;
j--;
}
return {x,space};
}
pair<int,int> downright(int ii, int jj){
int x=0,space=0;
int i=ii+1,j=jj+1;
while(i<10 && j<10){
if(a[i][j] == 'X') x++;
else{
if(a[i][j] == '.') space++;
break;
}
i++;
j++;
}
return {x,space};
}
pair<int,int> downleft(int ii, int jj){
int x=0,space=0;
int i=ii+1,j=jj-1;
while(i<10 && j>=0){
if(a[i][j] == 'X') x++;
else{
if(a[i][j] == '.') space++;
break;
}
i++;
j--;
}
return {x,space};
}
signed main() {
fast
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
cin>>a[i][j];
}
}
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
if(a[i][j] == 'O') continue;
auto u = up(i,j);
auto d = down(i,j);
auto l = left(i,j);
auto r = right(i,j);
auto ur = upright(i,j);
auto ul = upleft(i,j);
auto dr = downright(i,j);
auto dl = downleft(i,j);
if(a[i][j]=='X'){
if((u.first+d.first >= 3 && u.second+d.second == 1) || (u.first+d.first >= 4)){
cout<<"YES";
return 0;
}
else if((l.first+r.first >= 3 && l.second+r.second == 1) || (l.first+r.first >= 4)){
cout<<"YES";
return 0;
}
else if((ul.first+dr.first >= 3 && ul.second+dr.second == 1) || (ul.first+dr.first >= 4)){
cout<<"YES";
return 0;
}
else if((dl.first+ur.first >= 3 && dl.second+ur.second == 1) || (dl.first+ur.first >= 4)){
cout<<"YES";
return 0;
}
}
else {
if (u.first + d.first >= 4) {
cout << "YES";
return 0;
} else if (l.first + r.first >= 4) {
cout << "YES";
return 0;
} else if (ul.first + dr.first >= 4) {
cout << "YES";
return 0;
} else if (dl.first + ur.first >= 4) {
cout << "YES";
return 0;
}
}
}
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgaW50IGxvbmcgbG9uZwojZGVmaW5lIGVuZGwgJ1xuJwojZGVmaW5lIHRlc3QgaW50IF87IGNpbiA+PiBfOyB3aGlsZSAoXy0tKQojZGVmaW5lIG1vZCAxMDAwMDAwMDA3CiNkZWZpbmUgZmFzdCBpb3M6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7Y2luLnRpZSgwKTtjb3V0LnRpZSgwKTsKCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgYVsxMF1bMTBdOwpwYWlyPGludCxpbnQ+IHVwKGludCBpaSwgaW50IGpqKXsKICAgIGludCB4PTAsc3BhY2U9MDsKICAgIGZvcihpbnQgaT1paS0xO2k+PTA7aS0tKXsKICAgICAgICBpZihhW2ldW2pqXSA9PSAnWCcpIHgrKzsKICAgICAgICBlbHNlewogICAgICAgICAgICBpZihhW2ldW2pqXSA9PSAnLicpIHNwYWNlKys7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgIH0KICAgIHJldHVybiB7eCxzcGFjZX07Cn0KcGFpcjxpbnQsaW50PiBkb3duKGludCBpaSwgaW50IGpqKXsKICAgIGludCB4PTAsc3BhY2U9MDsKICAgIGZvcihpbnQgaT1paSsxO2k8MTA7aSsrKXsKICAgICAgICBpZihhW2ldW2pqXSA9PSAnWCcpIHgrKzsKICAgICAgICBlbHNlewogICAgICAgICAgICBpZihhW2ldW2pqXSA9PSAnLicpIHNwYWNlKys7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgIH0KICAgIHJldHVybiB7eCxzcGFjZX07Cn0KcGFpcjxpbnQsaW50PiBsZWZ0KGludCBpaSwgaW50IGpqKXsKICAgIGludCB4PTAsc3BhY2U9MDsKICAgIGZvcihpbnQgaj1qai0xO2o+PTA7ai0tKXsKICAgICAgICBpZihhW2lpXVtqXSA9PSAnWCcpIHgrKzsKICAgICAgICBlbHNlewogICAgICAgICAgICBpZihhW2lpXVtqXSA9PSAnLicpIHNwYWNlKys7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgIH0KICAgIHJldHVybiB7eCxzcGFjZX07Cn0KcGFpcjxpbnQsaW50PiByaWdodChpbnQgaWksIGludCBqail7CiAgICBpbnQgeD0wLHNwYWNlPTA7CiAgICBmb3IoaW50IGo9amorMTtqPDEwO2orKyl7CiAgICAgICAgaWYoYVtpaV1bal0gPT0gJ1gnKSB4Kys7CiAgICAgICAgZWxzZXsKICAgICAgICAgICAgaWYoYVtpaV1bal0gPT0gJy4nKSBzcGFjZSsrOwogICAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICB9CiAgICByZXR1cm4ge3gsc3BhY2V9Owp9CnBhaXI8aW50LGludD4gdXByaWdodChpbnQgaWksIGludCBqail7CiAgICBpbnQgeD0wLHNwYWNlPTA7CiAgICBpbnQgaT1paS0xLGo9amorMTsKICAgIHdoaWxlKGk+PTAgJiYgajwxMCl7CiAgICAgICAgaWYoYVtpXVtqXSA9PSAnWCcpIHgrKzsKICAgICAgICBlbHNlewogICAgICAgICAgICBpZihhW2ldW2pdID09ICcuJykgc3BhY2UrKzsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgfQogICAgICAgIGktLTsKICAgICAgICBqKys7CiAgICB9CiAgICByZXR1cm4ge3gsc3BhY2V9Owp9CnBhaXI8aW50LGludD4gdXBsZWZ0KGludCBpaSwgaW50IGpqKXsKICAgIGludCB4PTAsc3BhY2U9MDsKICAgIGludCBpPWlpLTEsaj1qai0xOwogICAgd2hpbGUoaT49MCAmJiBqPj0wKXsKICAgICAgICBpZihhW2ldW2pdID09ICdYJykgeCsrOwogICAgICAgIGVsc2V7CiAgICAgICAgICAgIGlmKGFbaV1bal0gPT0gJy4nKSBzcGFjZSsrOwogICAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgICAgaS0tOwogICAgICAgIGotLTsKICAgIH0KICAgIHJldHVybiB7eCxzcGFjZX07Cn0KcGFpcjxpbnQsaW50PiBkb3ducmlnaHQoaW50IGlpLCBpbnQgamopewogICAgaW50IHg9MCxzcGFjZT0wOwogICAgaW50IGk9aWkrMSxqPWpqKzE7CiAgICB3aGlsZShpPDEwICYmIGo8MTApewogICAgICAgIGlmKGFbaV1bal0gPT0gJ1gnKSB4Kys7CiAgICAgICAgZWxzZXsKICAgICAgICAgICAgaWYoYVtpXVtqXSA9PSAnLicpIHNwYWNlKys7CiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgICAgICBpKys7CiAgICAgICAgaisrOwogICAgfQogICAgcmV0dXJuIHt4LHNwYWNlfTsKfQpwYWlyPGludCxpbnQ+IGRvd25sZWZ0KGludCBpaSwgaW50IGpqKXsKICAgIGludCB4PTAsc3BhY2U9MDsKICAgIGludCBpPWlpKzEsaj1qai0xOwogICAgd2hpbGUoaTwxMCAmJiBqPj0wKXsKICAgICAgICBpZihhW2ldW2pdID09ICdYJykgeCsrOwogICAgICAgIGVsc2V7CiAgICAgICAgICAgIGlmKGFbaV1bal0gPT0gJy4nKSBzcGFjZSsrOwogICAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgICAgaSsrOwogICAgICAgIGotLTsKICAgIH0KICAgIHJldHVybiB7eCxzcGFjZX07Cn0KCnNpZ25lZCBtYWluKCkgewogICAgZmFzdAogICAgZm9yKGludCBpPTA7aTwxMDtpKyspewogICAgICAgIGZvcihpbnQgaj0wO2o8MTA7aisrKXsKICAgICAgICAgICAgY2luPj5hW2ldW2pdOwogICAgICAgIH0KICAgIH0KICAgIGZvcihpbnQgaT0wO2k8MTA7aSsrKXsKICAgICAgICBmb3IoaW50IGo9MDtqPDEwO2orKyl7CiAgICAgICAgICAgIGlmKGFbaV1bal0gPT0gJ08nKSBjb250aW51ZTsKICAgICAgICAgICAgYXV0byB1ID0gdXAoaSxqKTsKICAgICAgICAgICAgYXV0byBkID0gZG93bihpLGopOwogICAgICAgICAgICBhdXRvIGwgPSBsZWZ0KGksaik7CiAgICAgICAgICAgIGF1dG8gciA9IHJpZ2h0KGksaik7CiAgICAgICAgICAgIGF1dG8gdXIgPSB1cHJpZ2h0KGksaik7CiAgICAgICAgICAgIGF1dG8gdWwgPSB1cGxlZnQoaSxqKTsKICAgICAgICAgICAgYXV0byBkciA9IGRvd25yaWdodChpLGopOwogICAgICAgICAgICBhdXRvIGRsID0gZG93bmxlZnQoaSxqKTsKICAgICAgICAgICAgaWYoYVtpXVtqXT09J1gnKXsKICAgICAgICAgICAgICAgIGlmKCh1LmZpcnN0K2QuZmlyc3QgPj0gMyAmJiB1LnNlY29uZCtkLnNlY29uZCA9PSAxKSB8fCAodS5maXJzdCtkLmZpcnN0ID49IDQpKXsKICAgICAgICAgICAgICAgICAgICBjb3V0PDwiWUVTIjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgaWYoKGwuZmlyc3Qrci5maXJzdCA+PSAzICYmIGwuc2Vjb25kK3Iuc2Vjb25kID09IDEpIHx8IChsLmZpcnN0K3IuZmlyc3QgPj0gNCkpewogICAgICAgICAgICAgICAgICAgIGNvdXQ8PCJZRVMiOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgZWxzZSBpZigodWwuZmlyc3QrZHIuZmlyc3QgPj0gMyAmJiB1bC5zZWNvbmQrZHIuc2Vjb25kID09IDEpIHx8ICh1bC5maXJzdCtkci5maXJzdCA+PSA0KSl7CiAgICAgICAgICAgICAgICAgICAgY291dDw8IllFUyI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBlbHNlIGlmKChkbC5maXJzdCt1ci5maXJzdCA+PSAzICYmIGRsLnNlY29uZCt1ci5zZWNvbmQgPT0gMSkgfHwgKGRsLmZpcnN0K3VyLmZpcnN0ID49IDQpKXsKICAgICAgICAgICAgICAgICAgICBjb3V0PDwiWUVTIjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgICAgIGlmICh1LmZpcnN0ICsgZC5maXJzdCA+PSA0KSB7CiAgICAgICAgICAgICAgICAgICAgY291dCA8PCAiWUVTIjsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobC5maXJzdCArIHIuZmlyc3QgPj0gNCkgewogICAgICAgICAgICAgICAgICAgIGNvdXQgPDwgIllFUyI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHVsLmZpcnN0ICsgZHIuZmlyc3QgPj0gNCkgewogICAgICAgICAgICAgICAgICAgIGNvdXQgPDwgIllFUyI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGRsLmZpcnN0ICsgdXIuZmlyc3QgPj0gNCkgewogICAgICAgICAgICAgICAgICAgIGNvdXQgPDwgIllFUyI7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0=