#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<iomanip>
using namespace std;
using ll = long long;
using db = double;
vector<vector<int>>w(10, vector<int>(10, 0)),used(10, vector<int>(10, 0));
void dfs(int i, int j, int kor) {
	used[i][j] = kor;
	if (i + 1 < 10 and w[i + 1][j] == 1 and used[i + 1][j] == 0) {
		dfs(i + 1, j, kor);
	}
	if (j + 1 < 10 and w[i][j + 1] == 1 and used[i][j + 1] == 0) {
		dfs(i, j + 1, kor);
	}
	if (i > 0 and w[i - 1][j] == 1 and used[i - 1][j] == 0) {
		dfs(i - 1, j, kor);
	}
	if (j > 0 and w[i][j - 1] == 1 and used[i][j - 1] == 0) {
		dfs(i, j - 1, kor);
	}
}
void solve() {
	
	for (int i = 0; i < 10; ++i) {
		for (int j = 0; j < 10; ++j) {
			char x; cin >> x;
			if (x == '#') {
				w[i][j] = 1;
			}
		}
	}
	for (int i = 1; i < 9; ++i) {
		for (int j = 1; j < 9; ++j) {
			if (w[i][j] == 0)continue;
			if (w[i + 1][j + 1] == 1) {
				//cout << i << " " << j << ", " << i + 1 << " " << j + 1 << "\n";
				cout << "NO\n";
				return;
			}
			if (w[i - 1][j - 1] == 1) {
				//cout << i << " " << j << ", " << i - 1 << " " << j - 1 << "\n";

				cout << "NO\n";
				return;
			}
			if (w[i + 1][j - 1] == 1) {
				//cout << i << " " << j << ", " << i + 1 << " " << j - 1 << "\n";

				cout << "NO\n";
				return;
			}
			if (w[i - 1][j + 1] == 1) {
				//cout << i << " " << j << ", " << i - 1 << " " << j + 1 << "\n";

				cout << "NO\n";
				return;
			}
		}
	}
	int kor = 1;
	for (int i = 0; i < 10; ++i) {
		for (int j = 0; j < 10; ++j) {
			if (w[i][j] == 1 and used[i][j] == 0) {
				dfs(i, j, kor); ++kor;
			}
		}
	}
	vector<int>kor_sz(kor - 1);
	for (int i = 0; i < 10; ++i) {
		for (int j = 0; j < 10; ++j) {
			if (used[i][j] > 0)kor_sz[used[i][j] - 1]++;
		}
	}
	sort(kor_sz.begin(), kor_sz.end());
	vector<int>godans = { 1,1,1,1,2,2,2,3,3,4 };
	//for (auto c : kor_sz)cout << c << " ";
	if (kor_sz == godans)cout << "YES\n";
	else cout << "NO\n";
}

int main()
{
	//freopen("input.txt", "r", stdin);//freopen("output.txt", "w", stdout);
	cin.tie(0)->sync_with_stdio(0);
	cout.tie(0)->sync_with_stdio(0);
	int t = 1;
	//cin>>t;
	while (t--) {
		solve();
	}
}