#include "bits/stdc++.h"
using namespace std;

vector<int> t(1000), sz(1000, 1);

int get(int a){
    return a == t[a] ? a : t[a] = get(t[a]);
}

void unite(int a, int b){
    a = get(a), b = get(b);
    if(a == b) return;
    t[a] = b;
    sz[b] += sz[a];
}

int main() {
    int n = 10;
    vector<string> v(n);

    for(int i = 0; i < n;i ++){
        cin >> v[i];
    }
    vector<int> xs = {1, 1, -1, -1};
    vector<int> ys = {1, -1, 1, -1};
    iota(t.begin(), t.end(), 0);
    bool yes = 1;
    for(int i = 0;i < n;i ++){
        for(int j = 0;j < n;j ++){
        if(v[i][j] == '.') continue;
        int aa = 0, bb = 0;

        if(i < n - 1 && v[i + 1][j] == '#'){
            unite(i * n + j, (i + 1) * n + j);
            aa = 1;
        }
        if(i && v[i- 1][j] == '#'){
            aa = 1;
        }
        if(j < n - 1 && v[i][j + 1] == '#'){
            unite(i * n + j, i * n + j + 1);
            bb = 1;
        }
        if(j && v[i][j - 1] == '#'){
            bb = 1;

        }
        if(aa && bb) yes = 0;
        for (int p = 0; p < 4; p++) {
            auto [x, y] = make_pair(i + xs[p], j + ys[p]);
            if (x < 0 or y < 0 or x >= n or y >= n) continue;
            if (v[i][j] == '#' and v[x][y] == '#') yes = 0;
        }
        }
    }
    map<int,int> comp;
    for(int i = 0; i < n; i ++){
        for(int j = 0; j < n; j ++){
            if(v[i][j] == '.') continue;
            comp[get(i * n + j)] = sz[get(i * n + j)];
//            cout << comp[get(i * n + j)] << endl;
        }
    }
    if(comp.size() > 10) yes = 0;
    vector<int> cnt(1000);
    for(auto [a, b] : comp) cnt[b] ++;
    for(int i = 1; i <= 4; i ++) if(cnt[i] != 4 - i + 1) yes = 0;
    cout << (yes ? "YES" : "NO");

    return 0;
}
