#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

vector<vector<bool>> used;
vector<string> a(10);

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
   
    for (string& s : a) cin >> s;
       
    vector<int> ships = { 0, 4, 3, 2, 1 };
    
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            if (a[i][j] == '.') continue;

            if (i - 1 >= 0 && j - 1 >= 0 && a[i - 1][j - 1] == '#') {
                cout << "NO";
                return 0;
            }

            if (i + 1 < 10 && j - 1 >= 0 && a[i + 1][j - 1] == '#') {
                cout << "NO";
                return 0;
            }

            if (i - 1 >= 0 && j + 1 < 10 && a[i - 1][j + 1] == '#') {
                cout << "NO";
                return 0;
            }

            if (i + 1 < 10 && j + 1 < 10 && a[i + 1][j + 1] == '#') {
                cout << "NO";
                return 0;
            }
        }
    }

    vector<vector<bool>> used(10, vector<bool>(10, 0));
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            if (used[i][j] || a[i][j] == '.')
                continue;

            int sz1 = 0, sz2 = 0;
            for (int x = i; x < 10; x++) {
                if (a[x][j] == '#') {
                    sz1++;
                    used[x][j] = 1;
                }
                else break;
            }
            for (int y = j; y < 10; y++) {
                if (a[i][y] == '#') {
                    sz2++;
                    used[i][y] = 1;
                }
                else break;
            }
            int sz = max(sz1, sz2);
            
            if (sz > 4) {
                cout << "NO";
                return 0;
            }
            ships[sz]--;
        }
    }

    for (int x : ships)
        if (x != 0) {
            cout << "NO";
            return 0;
        }
    
    cout << "YES";
}