#include <iostream>
#include <vector>
#define int long long
using namespace std;
vector<vector<int>> gr(100);
int get_num(int i, int j) {
    return 10 * i + j;
}
int g = 0;
vector<int> vst(100);
void dfs(int v) {
    vst[v] = 1;
    g++;
    for (auto x : gr[v]) {
        if (!vst[x]) dfs(x);
    }

}
signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    char a[10][10];
    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 (a[i][j] == '.') continue;
            if (i != 0 && a[i - 1][j] == '#') {
                gr[get_num(i - 1, j)].push_back(get_num(i, j));
                gr[get_num(i, j)].push_back(get_num(i - 1, j));
            }
            if (i != 9 && a[i + 1][j] == '#') {
                gr[get_num(i + 1, j)].push_back(get_num(i, j));
                gr[get_num(i, j)].push_back(get_num(i + 1, j));
            }
            if (j != 0 && a[i][j - 1] == '#') {
                gr[get_num(i, j - 1)].push_back(get_num(i, j));
                gr[get_num(i, j)].push_back(get_num(i, j - 1));
            }
            if (j != 9 && a[i][j + 1] == '#') {
                gr[get_num(i, j + 1)].push_back(get_num(i, j));
                gr[get_num(i, j)].push_back(get_num(i, j + 1));
            }
        }
    }
    vector<int> cnt(101);
    int s = 0;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            if (a[i][j]=='.') continue;
            if (i != 0 && j != 0 && a[i - 1][j - 1] == '#') {
                cout << "NO";
                return 0;
            }
            if (i != 10 && j != 0 && a[i + 1][j - 1] == '#') {
                cout << "NO";
                return 0;
            }
            if (i != 0 && j != 10 && a[i - 1][j + 1] == '#') {
                cout << "NO";
                return 0;
            }
            if (i != 10 && j != 10 && a[i + 1][j + 1] == '#') {
                cout << "NO";
                return 0;
            }
        }
    }
    for (int i = 0; i < 100; i++) {
        if (!vst[i] && a[i / 10][i % 10] == '#') {
            dfs(i);
            s++;
            cnt[g]++;
            g = 0;
        }
    }
    if (s == 10 && cnt[1] == 4 && cnt[2] == 3 && cnt[3] == 2 && cnt[4] == 1) {
        cout << "YES";
    } else {
        cout << "NO";
    }
    return 0;
}
