#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
template<class T> istream& operator>>(istream& is, vector<T>& arr) { for(auto& i:arr) is>>i; return is;}
template<class T> ostream& operator<<(ostream& os, vector<T>& arr) { for(auto& i:arr) os<<i<<" "; return os;}


ll rec(ll w,ll h){
ll s = w*h;
if(w<h) swap(w,h);
if(w==1) return s;
return s+rec(w/2,h)+rec(w-w/2,h);
}
/// 2^log(w) = w

vector<string> f(10);

vector<int> cs;
int qc=0;

void dfs(int x,int y,int col){
if(x<0||x==10||y<0||y>10)return;
if(f[x][y]!='#')return;
f[x][y]=col;
cs.back()++;
dfs(x-1,y,col);
dfs(x+1,y,col);
dfs(x,y+1,col);
dfs(x,y-1,col);
}

signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);

cin>>f;


for(int i=0;i<9;i++)
    for(int j=0;j<9;j++)
     if( f[i+1][j]=='#' && f[i][j+1]=='#' ||f[i][j]=='#'&&f[i+1][j+1]=='#')
{
 cout<<"NO\n";return 0;
}


for(int i=0;i<10;i++)
    for(int j=0;j<10;j++)
    if(f[i][j]=='#')
{
    cs.push_back(0);
    dfs(i,j,qc);

qc++;
}

sort(all(cs));

if(cs==vector<int>({1,1,1,1,2,2,2,3,3,4}) ) cout<<"YES\n";
else cout<<"NO";
return 0;
}
