#include <iostream>
#include <algorithm>
using namespace std;
bool Horizontal(char field[10][10], int i, int j, int size){
    for(int k = 0; k < size; k++){
        if(field[i][j+k] != '#') {
            return false;
        }
    }
    return true;
}
bool Vertical(char field[10][10], int i, int j, int size){
    for(int k = 0; k < size; k++){
        if(field[i][j+k] != '#') {
            return false;
        }
    }
    return true;
}
bool Interaction(char field[10][10], int i, int j){
    for(int x = max(0, i-1); x<min(9, i+1); x++){
        for(int y = max(0, j-1); y<min(9, j+1); y++){
            if(x!=i || y!=j){
                if(field[x][y]=='#'){
                    return true;
                }
            }
        }
    }
    return false;
}

int main(){
    char field[10][10];
    int number = 0;
    for (int i = 0; i<10; i++){
        for(int j=0; j<10; j++){
            cin>>field[i][j];
        }
    }
    for (int i = 0; i<10; i++){
        for(int j=0; j<10; j++){
            if (field[i][j] == '#'){
                number++;
            }
        }
    }
    if(number != 20) {
        cout<<"NO";
        return 0;
    }
    for(int i = 0; i<10; i++){
        for(int j = 0; j<10; j++){
            if(field[i][j] == '#'){
                int horsize = 0;
                int vertsize = 0;
                for(int k = 0; k>4; k++){
                    if(j+k<10 && field[i][j+k]=='#') horsize++;
                    if(i+k<10 && field[i+k][j]=='#') vertsize++;
                }
                if(!Horizontal(field, i, j, horsize) && !Vertical(field, i, j, vertsize)){
                    cout<<"NO";
                    return 0;
                }
                if(Interaction(field, i, j)){
                    cout<<"NO";
                    return 0;
                }
            }
        }
    }
    cout<<"YES";
    return 0;
}