#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define str string
#define ldb long double
#define ll long long
#define db double
#define ull unsigned long long
#define ss second
#define ff first
#define pob pop_back
#define pub push_back
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(), v.end()
const ll INF18 = 2e18;
const int INF9 = 2e9;
const db PI = acos(-1);
const db EPS = 1e-5;
mt19937 rnd(time(0));
template <typename T, typename TT>
ostream& operator<<(ostream& out, pair<T, TT> &a) {
    out << "{" << a.ff << ' ' << a.ss << '\n';
    return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> &a) {
    for (auto it : a)
        out << it << ' ';
    return out;
}
template <typename T>
ostream& operator<<(ostream& out, set<T> &a) {
    for (auto it : a)
        out << it << ' ';
    return out;
}
#define print(...) cout << #__VA_ARGS__ << " = " << __VA_ARGS__ << '\n'
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define int ll

char a[10][10];

bool used[10][10];

int cnt, dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy[8] = {-1, 0, 1, -1, 1, -1, 0, 1}, mnx, mny, mxx, mxy;

void dfs(int i, int j) {
    used[i][j] = true;
    cnt++;
    mnx = min(mnx, i);
    mxx = max(mxx, i);
    mny = min(mny, j);
    mxy = max(mxy, j);
    for (int k = 0; k < 8; ++k) {
        int x1 = i + dx[k], y1 = j + dy[k];
        if (x1 >= 0 && x1 < 10 && y1 >= 0 && y1 < 10) {
            if (!used[x1][y1] && a[x1][y1] == '#') {
                dfs(x1, y1);
            }
        }
    }
}

signed main() {
    fast
    for (int i = 0; i < 10; ++i) {
        for (int j = 0; j < 10; ++j) {
            cin >> a[i][j];
        }
    }
    map <int, int> m;
    for (int i = 0; i < 10; ++i) {
        for (int j = 0; j < 10; ++j) {
            if (used[i][j] || a[i][j] == '.') {
                continue;
            }
            cnt = 0;
            mnx = mxx = i;
            mny = mxy = j;
            dfs(i, j);
            mxx++;
            mxy++;
            if (cnt != (mxx - mnx) * (mxy - mny)) {
                cout << "NO" << '\n';
                return 0;
            }
            m[cnt]++;
        }
    }
    if (m[1] == 4 && m[2] == 3 && m[3] == 2 && m[4] == 1 && m.size() == 4) {
        cout << "YES" << '\n';
    } else {
        cout << "NO" << '\n';
    }
    return 0;
}
