#include <iostream>
#include <vector>
#include <map>

using namespace std;

vector<int> dx = {1, -1, 0, 0}, dy = {0, 0, 1, -1};
char a[10][10];
bool was[10][10];
int calc[10][10];
vector<vector<pair<int, int>>> p;

bool check(int i, int j){
    return (0 <= i && i < 10 && 0 <= j && j < 10);
}

bool islodka(vector<pair<int, int>>& ve){
    bool x = true;
    bool y = true;
    for(auto p : ve){
        x &= (p.first == ve[0].first);
        y &= (p.second == ve[0].second);
    }
    return (x or y);
}

void dfs(int i, int j, vector<pair<int, int>>& v){
    v.emplace_back(i, j);
    was[i][j] = true;
    for(int ind = 0; ind < 4; ind++){
        int nextx = i + dx[ind];
        int nexty = j + dy[ind];
        if(check(nextx, nexty) && (!was[nextx][nexty] && a[nextx][nexty] == '#')){
            dfs(nextx, nexty, v) ;
        }
    }
}

int main(){
    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(!was[i][j] && a[i][j] == '#'){
                vector<pair<int, int>> tmp;
                dfs(i, j, tmp);
                p.push_back(tmp);
            }
        }
    }

    map<int, int> cnt;
    int cur = 0;
    for(auto cmp : p){
        if(!islodka(cmp)){
            cout << "NO";
            return 0;
        }
        cnt[cmp.size()]++;
        for(auto p : cmp){
            calc[p.first][p.second] = cur;
        }
        cur++;
    }

    bool ok = true;
    for(int i = 1;i <= 4;i++) ok &= (cnt[i] == 5 - i);
    if(!ok){
        cout << "NO\n";
        return 0;
    }

    for(int i = 0;i < 9;i++){
        for(int j = 0;j < 9;j++){
            int dxx[] = {0, 1, 0, 1};
            int dyy[] = {0, 0, 1, 1};
            for(int i1 = 0; i1 < 4; i1++){
                for(int i2 = i1 + 1; i2 < 4; i2++){
                    pair<int,int> one = {i + dxx[i1], j + dyy[i1]}, two =  {i + dxx[i2], j + dyy[i2]};
                    if(a[one.first][one.second] == '#' && a[two.first][two.second] == '#'){
                        if(one.first == two.first || one.second == two.second){
                            if(calc[one.first][one.second] != calc[two.first][two.second]){
                                cout << "NO\n";
                                return 0;
                            }
                        }
                        else if(one.first != two.first && one.second != two.second){
                            cout << "NO\n";
                            return 0;
                        }
                    }
                }
            }
        }
    }

    cout << "YES";
}