// Bismilliyahi Rohmanir Rohim!
// In the name of Allah the Most Gracious,
// The Most Merciful.
// We're nothing and you're everything.
#include <fstream>
#include <bits/stdc++.h>
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx,mmx,tune=native")
// #include <ext/pb_ds/detail/standard_policies.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace __gnu_pbds;
// typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
/* find_by_order() order_of_key() */
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef DEBUG
#define dbg(x...) cerr << "\e[91m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[39m" << endl;
#else
#define dbg(x...)
#endif
#define elif else if
#define pb push_back
#define fast cin.tie(nullptr); ios_base::sync_with_stdio(false);
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define str to_string 
#define sz(x) int(x.size())
#define F first 
#define S second
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define watch(x) cout << #x << " <----  " << x << endl
mt19937 rng (chrono::steady_clock::now().time_since_epoch().count());
using ll = long long;
using ld = long double;
using ull = unsigned long long;
const int N = 3e5 + 1;
const ll mod = 1e9 + 7;
const int INF = 1e9;
ll n, m, k, q;
int h1[4] = {1,0,0,-1};
int h2[4] = {0,-1,1,0};
ll binpow(ll a, ll b){
    if(b == 0) return 1;
    if(b % 2) return (a % mod * binpow(a, b - 1)% mod) % mod;
    else return (binpow(a, b / 2) % mod * binpow(a, b / 2) % mod) % mod;
}
ll model(ll a, ll b){
    // (a % MOD * b^(MOD - 2) % MOD) % MOD;
    return (a % mod * binpow(b, (mod - 2)) % mod) % mod;
}
ll a[N];
bool check(int x, int y){
    return (x >= 0 && y >= 0 && x < n && y < m);
}
int go(char c){
    return c - '0';
}

char c[12][12];
bool was[12][12];

multiset<int> s;

int bfs(int xx, int yy)
{
    if (c[xx][yy] != '#' || was[xx][yy])
    {
        return 0;
    }
    
    queue<pair<pair<int, int>, int>> q;
    q.push({{xx, yy}, 1});
    int dir = 0;
    int lnn = 0;
    
    while (!q.empty())
    {
        int x = q.front().first.first;
        int y = q.front().first.second;
        int l = q.front().second;
        q.pop();
        
        was[x][y] = 1;

        for (int i = -1; i <= 1; i += 2)
        {
            for (int j = -1; j <= 1; j += 2)
            {
                if (c[x + i][y + j] == '#')
                    return -1;
            }
        }
        if (c[x + 1][y] == '#')
        {
            if (dir == 0)
                dir = 1;
            if (dir == 2)
                return -1;
            
            q.push({{x + 1, y}, l + 1});
        }
        if (c[x][y + 1] == '#')
        {
            if (dir == 0)
                dir = 2;
            if (dir == 1)
                return -1;

            q.push({{x, y + 1}, l + 1});
        }
        lnn = max(lnn, l);
    }
    
    return lnn;
}

void solve(){
    int n = 10;
    
    for (int i = 1; i <= 10; i++)
    {
        for (int j = 1; j <= 10; j++)
        {
            cin >> c[i][j];
        }
    }
    
    for (int i = 1; i <= 10; i++)
    {
        for (int j = 1; j <= 10; j++)
        {
            int res = bfs(i, j);
            if (res == -1 || res > 4)
            {
                cout << "NO";
                return;
            }
            else if (res != 0)
                s.insert(res);
        }
    }
    
    for (int i = 1; i <= 4; i++)
    {
        if (s.count(i) != 5 - i)
        {
            cout << "NO";
            return;
        }
    }
    
    cout << "YES";
}

/*Give me some sunshine, give me some rain, its a beatifull day-ay-ay-ay...*/
int32_t main(){
    fast
    int tt = 1;
    // cin >> tt;
    while(tt--){
        solve();
    }
}
