#include <bits/stdc++.h>
using namespace std;
 
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
// using namespace __gnu_pbds;
  
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
// find_by_order
// order_of_key
 
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define vt vector
#define y1 ggwp
#define rt return
#define br break
#define cn continue
#define en '\n'
#define yes cout << "YES\n";
#define no cout << "NO\n"
#define yesno(x); cout << (x ? "YES\n" : "NO\n");
#define dbg(x) cout << (#x) << ": " << (x) << '\n';
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rev(x) reverse(x.begin(), x.end())
#define sz(x) (int)x.size()
#define left stupid_left
#define right stupid_right
 
template<class T, class TT> void mineq(T& a, const TT& b){ if (b < a) a = b;}
template<class T, class TT> void maxeq(T& a, const TT& b){ if (b > a) a = b;}
 
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) 
#define file_io freopen(".in", "r", stdin); freopen(".out", "w", stdout)
 
typedef double ld;
typedef long long ll;
typedef vector<int> vi; 
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<ll, ll>> vll;
    
vii dir = {
    {1, 0},
    {-1, 0},
    {0, 1},
    {0, -1}
};

bool chk(int i, int j){
    rt (0 <= i && i < 10 && 0 <= j && j < 10);
}

bool keme(vii hh){
    bool is1 = 1, is2 = 1;
    for(auto p : hh){
        is1 &= (p.f == hh[0].f);
        is2 &= (p.s == hh[0].s);
    }
    
    rt (is1 || is2);
}

char a[10][10];
int used[10][10], comp[10][10];

vii vv;
vt<vii> tt;

void dfs(int i, int j){
    used[i][j] = 1;
    vv.pb({i, j});
    for(auto d : dir){
        int toi = i + d.f, toj = j + d.s;
        if(chk(toi, toj)){
            if(!used[toi][toj] && a[toi][toj] == '#'){

                dfs(toi, toj);

            }
        }
    }
}

int main(){
    fast_io;

    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(!used[i][j] && a[i][j] == '#'){

                vv.clear();
                dfs(i, j);
                tt.pb(vv);

            }
        }
    }

    map<int, int> cnt;
    int comp_num = 0;
    for(auto cmp : tt){
        if(!keme(cmp)){
            cout << "NO"; exit(0);
        }
        cnt[cmp.size()]++;
        for(auto p : cmp){
            comp[p.f][p.s] = comp_num;
            //cout << "{" << p.f << ";" << p.s << "}" << " - ";
        }
        comp_num++;
        //cout << en;
    }

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

    for(int i = 0;i < 9;i++){
        for(int j = 0;j < 9;j++){

            vii gg = {
                {i, j},
                {i + 1, j},
                {i, j + 1},
                {i + 1, j + 1}
            };

            for(int ii = 0;ii < 4;ii++){
                for(int jj = ii + 1;jj < 4;jj++){

                    pii A = gg[ii], B = gg[jj];

                    if(a[A.f][A.s] == '#' && a[B.f][B.s] == '#'){

                        if(A.f == B.f || A.s == B.s){
                            if(comp[A.f][A.s] != comp[B.f][B.s]){
                                cout << "NO"; exit(0);
                            }
                        }

                        if(A.f != B.f && A.s != B.s){
                            cout << "NO"; exit(0);
                        }

                    }

                }
            }

        }
    }

    cout << "YES";
}