Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.

In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins immediately.

Alice wins if some crosses in the field form line of length not smaller than 5. This line can be horizontal, vertical and diagonal.


-----Input-----

You are given matrix 10 × 10 (10 lines of 10 characters each) with capital Latin letters 'X' being a cross, letters 'O' being a nought and '.' being an empty cell. The number of 'X' cells is equal to the number of 'O' cells and there is at least one of each type. There is at least one empty cell.

It is guaranteed that in the current arrangement nobody has still won.


-----Output-----

Print 'YES' if it's possible for Alice to win in one turn by putting cross in some empty cell. Otherwise print 'NO'.


-----Examples-----
Input
XX.XX.....
.....OOOO.
..........
..........
..........
..........
..........
..........
..........
..........

Output
YES

Input
XXOXX.....
OO.O......
..........
..........
..........
..........
..........
..........
..........
..........

Output
NO

Difficulty: MEDIUM_HARD

Solutions:
a = [input() for i in range(10)]
gg = False

def checkAns(b):
	dot = 0
	x = 0
	for i in b:
		if i == 'X':
			x += 1
		if i == '.':
			dot += 1
	if x == 4 and dot == 1 or x == 5:
		return True

def find(b):
	if len(b) < 5:
		return
	global gg
	ans = 0
	for i in range(len(b) - 4):
		if checkAns(b[i:i + 5]):
			gg = True
			return
for i in range(10):
	find(a[i])
	find(''.join([a[j][i] for j in range(10)]))
	find(''.join([a[j][j + i] for j in range(10) if j + i < 10]))
	find(''.join([a[j + i][j] for j in range(10) if j + i < 10]))
	find(''.join([a[j][9 - j - i] for j in range(10) if 9 - j - i >= 0]))
	find(''.join([a[j + i][9 - j] for j in range(10) if j + i < 10]))
if gg:
	print('YES')
else:
	print('NO')


from collections import defaultdict, deque
from heapq import heappush, heappop
from math import inf
ri = lambda : map(int, input().split())

def solve():
	A = []
	for _ in range(10):
		A.append(list(input()))
	valid = False
	for r in range(10):
		for c in range(10):
			if A[r][c] != '.':
				continue
			left = 0
			pos = c - 1
			while pos >= 0 and A[r][pos] == 'X':
				left += 1
				pos -= 1
			pos = c + 1
			right = 0
			while pos < 10 and A[r][pos] == 'X':
				right += 1
				pos += 1
			if left + right + 1 >= 5:
				valid = True
				break
			diag1 = 0
			pr = r - 1
			cr = c + 1
			while pr >= 0 and cr < 10 and (A[pr][cr] == 'X'):
				diag1 += 1
				pr -= 1
				cr += 1
			diag2 = 0
			pr = r + 1
			cr = c - 1
			while pr < 10 and cr >= 0 and (A[pr][cr] == 'X'):
				diag2 += 1
				pr += 1
				cr -= 1
			if diag1 + diag2 + 1 >= 5:
				valid = True
			diag1 = 0
			pr = r - 1
			cr = c - 1
			while pr >= 0 and cr >= 0 and (A[pr][cr] == 'X'):
				diag1 += 1
				pr -= 1
				cr -= 1
			diag2 = 0
			pr = r + 1
			cr = c + 1
			while pr < 10 and cr < 10 and (A[pr][cr] == 'X'):
				diag2 += 1
				pr += 1
				cr += 1
			if diag1 + diag2 + 1 >= 5:
				valid = True
			up = 0
			pos = r - 1
			while pos >= 0 and A[pos][c] == 'X':
				up += 1
				pos -= 1
			down = 0
			pos = r + 1
			while pos < 10 and A[pos][c] == 'X':
				down += 1
				pos += 1
			if up + down + 1 >= 5:
				valid = True
		if valid:
			break
	if valid:
		print('YES')
	else:
		print('NO')
t = 1
while t:
	t -= 1
	solve()


a = [''] * 10
for i in range(10):
	a[i] = input()
AliceWins = False
for i in range(10 - 4):
	for j in range(10):
		count = 0
		dot = 0
		for k in range(5):
			if a[i + k][j] == 'X':
				count += 1
			elif a[i + k][j] == '.':
				dot += 1
		if count == 4 and dot:
			AliceWins = True
for i in range(10):
	for j in range(10 - 4):
		count = 0
		dot = 0
		for k in range(5):
			if a[i][j + k] == 'X':
				count += 1
			elif a[i][j + k] == '.':
				dot += 1
		if count == 4 and dot:
			AliceWins = True
for i in range(10 - 4):
	for j in range(10 - 4):
		count = 0
		dot = 0
		for k in range(5):
			if a[i + k][j + k] == 'X':
				count += 1
			elif a[i + k][j + k] == '.':
				dot += 1
		if count == 4 and dot:
			AliceWins = True
for i in range(10):
	a[i] = a[i][::-1]
for i in range(10 - 4):
	for j in range(10 - 4):
		count = 0
		dot = 0
		for k in range(5):
			if a[i + k][j + k] == 'X':
				count += 1
			elif a[i + k][j + k] == '.':
				dot += 1
		if count == 4 and dot:
			AliceWins = True
print('YES' if AliceWins else 'NO')


import sys
table = [line.strip() for line in sys.stdin]

def check_position(table, row, column):
	if table[row][column] != '.':
		return False
	left_sum = 0
	tmp = column - 1
	while tmp >= 0 and table[row][tmp] == 'X':
		left_sum += 1
		tmp -= 1
	right_sum = 0
	tmp = column + 1
	while tmp < 10 and table[row][tmp] == 'X':
		right_sum += 1
		tmp += 1
	if left_sum + right_sum >= 4:
		return True
	up_sum = 0
	tmp = row - 1
	while tmp >= 0 and table[tmp][column] == 'X':
		up_sum += 1
		tmp -= 1
	down_sum = 0
	tmp = row + 1
	while tmp < 10 and table[tmp][column] == 'X':
		down_sum += 1
		tmp += 1
	if up_sum + down_sum >= 4:
		return True
	maindup_sum = 0
	tmp_row = row - 1
	tmp_col = column - 1
	while tmp_row >= 0 and tmp_col >= 0 and (table[tmp_row][tmp_col] == 'X'):
		tmp_row -= 1
		tmp_col -= 1
		maindup_sum += 1
	maindup_down = 0
	tmp_row = row + 1
	tmp_col = column + 1
	while tmp_row < 10 and tmp_col < 10 and (table[tmp_row][tmp_col] == 'X'):
		tmp_row += 1
		tmp_col += 1
		maindup_down += 1
	if maindup_sum + maindup_down >= 4:
		return True
	dup_sum = 0
	tmp_row = row - 1
	tmp_col = column + 1
	while tmp_row >= 0 and tmp_col < 10 and (table[tmp_row][tmp_col] == 'X'):
		tmp_row -= 1
		tmp_col += 1
		dup_sum += 1
	dup_down = 0
	tmp_row = row + 1
	tmp_col = column - 1
	while tmp_row < 10 and tmp_col >= 0 and (table[tmp_row][tmp_col] == 'X'):
		tmp_row += 1
		tmp_col -= 1
		dup_down += 1
	if dup_sum + dup_down >= 4:
		return True
	return False
for row in range(10):
	for column in range(10):
		if check_position(table, row, column):
			print('YES')
			sys.exit(0)
print('NO')


field = []

def full_line(x, y, vx, vy):
	global field
	summ = 0
	for k in range(0, 5):
		if x == len(field) or y == len(field[x]) or x == -1 or (y == -1) or ('O' == field[x][y]):
			return False
		if 'X' == field[x][y]:
			summ += 1
		x += vx
		y += vy
	return summ > 3
for i in range(0, 10):
	field.append(list(input()))
for i in range(0, 10):
	for j in range(0, 10):
		if 'O' != field[i][j] and (full_line(i, j, 0, 1) or full_line(i, j, 1, 0) or full_line(i, j, 1, 1) or full_line(i, j, 1, -1)):
			print('YES')
			exit()
print('NO')


matrix = []
for i in range(10):
	matrix.append(list(input()))
alllines = matrix.copy()
for i in range(10):
	line = []
	for j in range(10):
		line.append(matrix[j][i])
	alllines.append(line)
for i in range(6):
	line = []
	x = i
	y = 0
	while x < 10 and y < 10:
		line.append(matrix[y][x])
		x += 1
		y += 1
	alllines.append(line)
for i in range(1, 6):
	line = []
	x = 0
	y = i
	while x < 10 and y < 10:
		line.append(matrix[y][x])
		x += 1
		y += 1
	alllines.append(line)
for i in range(9, 3, -1):
	line = []
	x = i
	y = 0
	while x >= 0 and y < 10:
		line.append(matrix[y][x])
		x -= 1
		y += 1
	alllines.append(line)
for i in range(1, 6):
	line = []
	x = 9
	y = i
	while x >= 0 and y < 10:
		line.append(matrix[y][x])
		x -= 1
		y += 1
	alllines.append(line)
f = False
for i in alllines:
	i = ''.join(i)
	for j in ['.XXXX', 'X.XXX', 'XX.XX', 'XXX.X', 'XXXX.']:
		if i.find(j) != -1:
			f = True
			break
if f:
	print('YES')
else:
	print('NO')


t = [[-1] * 12 for i in range(12)]
for i in range(1, 11):
	s = input()
	for j in range(1, 11):
		if s[j - 1] == '.':
			t[i][j] = 0
		elif s[j - 1] == 'X':
			t[i][j] = 1
c = False
for x in range(1, 11):
	for y in range(1, 11):
		if t[x][y] == 0:
			t[x][y] = 1
			for i in range(1, 11):
				for j in range(1, 11):
					if t[i][j] == 1:
						counter = 1
						for k in range(1, 5):
							if i - k > 0 and j + k < 11 and (t[i - k][j + k] == 1):
								counter += 1
						if counter == 5:
							c = True
							break
						counter = 1
						for k in range(1, 5):
							if j + k < 11 and t[i][j + k] == 1:
								counter += 1
						if counter == 5:
							c = True
							break
						counter = 1
						for k in range(1, 5):
							if i + k < 11 and t[i + k][j] == 1:
								counter += 1
						if counter == 5:
							c = True
							break
						counter = 1
						for k in range(1, 5):
							if i + k < 11 and j + k < 11 and (t[i + k][j + k] == 1):
								counter += 1
						if counter == 5:
							c = True
							break
			t[x][y] = 0
if c:
	print('YES')
else:
	print('NO')


matrix = []
for i in range(10):
	matrix.append(input())

def check_horizontal(matrix, x, y):
	misses = 0
	for dy in range(5):
		if matrix[x][y + dy] == 'O':
			return False
		if matrix[x][y + dy] == '.':
			misses += 1
	return misses == 1

def check_diagonal(matrix, x, y):
	misses = 0
	for dx in range(5):
		if matrix[x + dx][y + dx] == 'O':
			return False
		if matrix[x + dx][y + dx] == '.':
			misses += 1
	return misses == 1

def check_diagonal_inverse(matrix, x, y):
	misses = 0
	for dx in range(5):
		if matrix[x + dx][y - dx] == 'O':
			return False
		if matrix[x + dx][y - dx] == '.':
			misses += 1
	return misses == 1

def check_vertical(matrix, x, y):
	misses = 0
	for dx in range(5):
		if matrix[x + dx][y] == 'O':
			return False
		if matrix[x + dx][y] == '.':
			misses += 1
	return misses == 1
for i in range(10):
	for j in range(6):
		if check_horizontal(matrix, i, j) or check_vertical(matrix, j, i):
			print('YES')
			exit(0)
for i in range(6):
	for j in range(6):
		if check_diagonal(matrix, i, j) or check_diagonal_inverse(matrix, i, 4 + j):
			print('YES')
			exit(0)
print('NO')


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
a = [minp() for i in range(10)]
d = [(1, 0), (1, 1), (0, 1), (1, -1)]
for x in range(10):
	for y in range(10):
		for (dx, dy) in d:
			c1 = 0
			c2 = 0
			for j in range(5):
				xx = x + dx * j
				yy = y + dy * j
				if xx < 10 and yy < 10 and (yy >= 0):
					w = a[x + dx * j][y + dy * j]
					if w == 'X':
						c1 += 1
					elif w == '.':
						c2 += 1
			if c1 == 4 and c2 == 1:
				print('YES')
				exit(0)
print('NO')


def is_good(matrix):
	for i in range(10):
		for j in range(10):
			if matrix[i][j] == 'X':
				if matrix[i][j - 2] == matrix[i][j - 1] == matrix[i][j] == matrix[i][j + 1] == matrix[i][j + 2] or matrix[i - 2][j] == matrix[i - 1][j] == matrix[i][j] == matrix[i + 1][j] == matrix[i + 2][j]:
					return True
				for k in range(4):
					if matrix[i - k][j - k] == matrix[i - k + 1][j - k + 1] == matrix[i - k + 2][j - k + 2] == matrix[i - k + 3][j - k + 3] == matrix[i - k + 4][j - k + 4]:
						return True
					if matrix[i - k][j + k] == matrix[i - k + 1][j + k - 1] == matrix[i - k + 2][j + k - 2] == matrix[i - k + 3][j + k - 3] == matrix[i - k + 4][j + k - 4]:
						return True
	return False
matrix = [['.'] * 14 for i in range(14)]
for i in range(10):
	string = input()
	for j in range(10):
		matrix[i][j] = string[j]
for i in range(10):
	for j in range(10):
		if matrix[i][j] == '.':
			matrix[i][j] = 'X'
			if is_good(matrix):
				print('YES')
				exit()
			matrix[i][j] = '.'
print('NO')


def solve1(i, j, bool1, bool2):
	cnt0 = 0
	cnt1 = 0
	u = 0
	v = 0
	for k in range(1, 11):
		if bool1:
			u = k
		if bool2:
			v = k
		if not (0 <= i + u < 10 and 0 <= j + v < 10):
			break
		elif s[i + u][j + v] == 'X':
			cnt0 += 1
		else:
			break
	for k in range(1, 11):
		if bool1:
			u = -k
		if bool2:
			v = -k
		if not (0 <= i + u < 10 and 0 <= j + v < 10):
			break
		elif s[i + u][j + v] == 'X':
			cnt0 += 1
		else:
			break
	for k in range(1, 11):
		if bool1:
			u = -k
		if bool2:
			v = k
		if not (0 <= i + u < 10 and 0 <= j + v < 10):
			break
		elif s[i + u][j + v] == 'X':
			cnt1 += 1
		else:
			break
	for k in range(1, 11):
		if bool1:
			u = k
		if bool2:
			v = -k
		if not (0 <= i + u < 10 and 0 <= j + v < 10):
			break
		elif s[i + u][j + v] == 'X':
			cnt1 += 1
		else:
			break
	return max(cnt0, cnt1) >= 4

def solve(i, j):
	return solve1(i, j, False, True) or solve1(i, j, True, False) or solve1(i, j, True, True)
import sys
input = sys.stdin.readline
n = 10
s = [input() for i in range(n)]
flag = False
for i in range(n):
	for j in range(n):
		if s[i][j] == '.':
			flag |= solve(i, j)
if flag:
	print('YES')
else:
	print('NO')


s = []

def check():
	for i in range(10):
		for j in range(10):
			if j + 4 < 10:
				th = ''
				for k in range(5):
					th += s[i][j + k]
				if th == 'XXXXX':
					return True
	for i in range(10):
		for j in range(10):
			if i + 4 < 10:
				th = ''
				for k in range(5):
					th += s[i + k][j]
				if th == 'XXXXX':
					return True
	for i in range(10):
		for j in range(10):
			if i + 4 < 10 and j + 4 < 10:
				th = ''
				for k in range(5):
					th += s[i + k][j + k]
				if th == 'XXXXX':
					return True
	for i in range(10):
		for j in range(10):
			if i + 4 < 10 and j - 4 >= 0:
				th = ''
				for k in range(5):
					th += s[i + k][j - k]
				if th == 'XXXXX':
					return True
	return False
for i in range(10):
	s.append(list(input()))
flag = False
if check():
	flag = True
for i in range(10):
	for j in range(10):
		if s[i][j] == '.':
			s[i][j] = 'X'
			if check():
				flag = True
			s[i][j] = '.'
if flag:
	print('YES')
else:
	print('NO')


N = 10
patterns = ['.XXXX', 'XXXX.', 'XX.XX', 'XXX.X', 'X.XXX']

def game(s):
	cols = [[] for _ in range(N)]
	rows = [[] for _ in range(N)]
	fdiag = [[] for _ in range(N + N - 1)]
	bdiag = [[] for _ in range(len(fdiag))]
	min_bdiag = -N + 1
	for y in range(N):
		for x in range(N):
			cols[y].append(s[y][x])
			rows[x].append(s[y][x])
			fdiag[x + y].append(s[y][x])
			bdiag[-min_bdiag + x - y].append(s[y][x])
	for arr in [cols, rows, fdiag, bdiag]:
		for l in arr:
			line = ''.join(l)
			if line.count('X') >= 4:
				for p in patterns:
					if line.find(p) != -1:
						return True
	return False
s = [input() for _ in range(N)]
if game(s):
	print('YES')
else:
	print('NO')


rs = []
for i in range(10):
	length = input()
	rs.append(length)
temp1 = 1
flag1 = 1

def check(i, j, direct, temp, flag):
	if direct == 1:
		if j == 0:
			return 0
		j -= 1
	elif direct == 2:
		if j == 9:
			return 0
		j += 1
	elif direct == 3:
		if i == 0:
			return 0
		i -= 1
	elif direct == 4:
		if i == 9:
			return 0
		i += 1
	elif direct == 5:
		if i == 0 or j == 0:
			return 0
		j -= 1
		i -= 1
	elif direct == 6:
		if i == 9 or j == 0:
			return 0
		j -= 1
		i += 1
	elif direct == 7:
		if i == 0 or j == 9:
			return 0
		j += 1
		i -= 1
	elif direct == 8:
		if i == 9 or j == 9:
			return 0
		j += 1
		i += 1
	if rs[i][j] == 'X':
		temp += 1
		if temp > 4:
			return 1
		return check(i, j, direct, temp, flag)
	elif rs[i][j] == '.' and flag == 1:
		temp += 1
		flag = 0
		if temp > 4:
			return 1
		return check(i, j, direct, temp, flag)
	else:
		return 0

def result():
	for i in range(10):
		for j in range(10):
			if rs[i][j] == 'X':
				for k in range(1, 9):
					if check(i, j, k, temp1, flag1) == 1:
						return 1
	return 0
if result() == 0:
	print('NO')
else:
	print('YES')


a = ['$' * 12]
for i in range(10):
	a.append('$' + input() + '$')
a.append('$' * 12)

def count(r, c, dr, dc):
	k = 0
	while a[r][c] == 'X':
		k += 1
		r += dr
		c += dc
	return k
f = 0
for i in range(1, 11):
	if f == 1:
		break
	for j in range(1, 11):
		if a[i][j] == '.':
			h = count(i, j - 1, 0, -1) + count(i, j + 1, 0, 1)
			v = count(i + 1, j, 1, 0) + count(i - 1, j, -1, 0)
			d1 = count(i - 1, j - 1, -1, -1) + count(i + 1, j + 1, 1, 1)
			d2 = count(i + 1, j - 1, 1, -1) + count(i - 1, j + 1, -1, 1)
			if h >= 4 or v >= 4 or d1 >= 4 or (d2 >= 4):
				print('YES')
				f = 1
				break
if f == 0:
	print('NO')


T = [[] for i in range(10)]
for i in range(10):
	a = list(input())
	T[i] = a
flag = False
for i in range(10):
	for j in range(10):
		if T[i][j] == 'X':
			for (dx, dy) in [(0, -1), (-1, 0), (0, 1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]:
				flag2 = True
				cross = 0
				emp = 0
				for k in range(5):
					(nx, ny) = (i + k * dx, j + k * dy)
					if 0 <= nx < 10 and 0 <= ny < 10 and (T[nx][ny] == 'X'):
						cross += 1
					elif 0 <= nx < 10 and 0 <= ny < 10 and (T[nx][ny] == '.'):
						emp += 1
					else:
						flag2 = False
						break
				if flag2 and cross == 4 and (emp == 1):
					flag = True
if flag:
	print('YES')
else:
	print('NO')


import sys
l = ['' for i in range(10)]
for i in range(10):
	l[i] = input()
for i in range(10):
	for j in range(10):
		if j - 2 >= 0 and j + 2 < 10:
			s = l[i][j - 2:j + 3]
			if s.count('X') == 4 and s.count('O') == 0:
				print('YES')
				sys.exit()
		if i - 2 >= 0 and i + 2 < 10:
			s = l[i - 2][j] + l[i - 1][j] + l[i][j] + l[i + 1][j] + l[i + 2][j]
			if s.count('X') == 4 and s.count('O') == 0:
				print('YES')
				sys.exit()
		if j - 2 >= 0 and j + 2 < 10 and (i - 2 >= 0) and (i + 2 < 10):
			s = l[i - 2][j - 2] + l[i - 1][j - 1] + l[i][j] + l[i + 1][j + 1] + l[i + 2][j + 2]
			if s.count('X') == 4 and s.count('O') == 0:
				print('YES')
				sys.exit()
			s = l[i - 2][j + 2] + l[i - 1][j + 1] + l[i][j] + l[i + 1][j - 1] + l[i + 2][j - 2]
			if s.count('X') == 4 and s.count('O') == 0:
				print('YES')
				sys.exit()
print('NO')


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	s = []
	for i in range(10):
		s.append(list(si()))
	for i in range(10):
		for j in range(10):
			if i + 5 <= 10:
				ss = 0
				for k in range(i, i + 5):
					if s[k][j] == 'X':
						ss += 1
					elif s[k][j] == 'O':
						ss -= 1
				if ss >= 4:
					print('YES')
					return
			if j + 5 <= 10:
				ss = 0
				for k in range(j, j + 5):
					if s[i][k] == 'X':
						ss += 1
					elif s[i][k] == 'O':
						ss -= 1
				if ss >= 4:
					print('YES')
					return
			if i + 5 <= 10 and j + 5 <= 10:
				ss = 0
				k = i
				l = j
				for ii in range(5):
					if s[k][l] == 'X':
						ss += 1
					elif s[k][l] == 'O':
						ss -= 1
					k += 1
					l += 1
				if ss >= 4:
					print('YES')
					return
			if j - 5 >= -1 and i + 5 <= 10:
				ss = 0
				k = i
				l = j
				for ii in range(5):
					if s[k][l] == 'X':
						ss += 1
					elif s[k][l] == 'O':
						ss -= 1
					k += 1
					l -= 1
				if ss >= 4:
					print('YES')
					return
	print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
field = []
for i in range(10):
	st = input()
	field.append(st)

def f():
	global i, i2, c, j, j2, l
	for i in range(10):
		for i2 in range(6):
			l = field[i][i2:i2 + 5]
			if l.count('X') == 4 and l.count('.') == 1:
				print('YES')
				sys.exit()
	for i in range(10):
		for i2 in range(6):
			l = field[i2][i] + field[i2 + 1][i] + field[i2 + 2][i] + field[i2 + 3][i] + field[i2 + 4][i]
			if l.count('X') == 4 and l.count('.') == 1:
				print('YES')
				sys.exit()
	c = 0
	for i in range(4, 10):
		c += 1
		for i2 in range(c):
			j = i - i2
			j2 = 0 + i2
			l = field[j][j2] + field[j - 1][j2 + 1] + field[j - 2][j2 + 2] + field[j - 3][j2 + 3] + field[j - 4][j2 + 4]
			if l.count('X') == 4 and l.count('.') == 1:
				print('YES')
				sys.exit()
	for i2 in range(1, 6):
		c -= 1
		for i3 in range(c):
			j = i - i3
			j2 = i2 + i3
			l = field[j][j2] + field[j - 1][j2 + 1] + field[j - 2][j2 + 2] + field[j - 3][j2 + 3] + field[j - 4][j2 + 4]
			if l.count('X') == 4 and l.count('.') == 1:
				print('YES')
				sys.exit()
	c = 0
	for i in range(5, -1, -1):
		c += 1
		for i2 in range(c):
			j = i + i2
			j2 = 0 + i2
			l = field[j][j2] + field[j + 1][j2 + 1] + field[j + 2][j2 + 2] + field[j + 3][j2 + 3] + field[j + 4][j2 + 4]
			if l.count('X') == 4 and l.count('.') == 1:
				print('YES')
				sys.exit()
	for i2 in range(1, 6):
		c -= 1
		for i3 in range(c):
			j = i + i3
			j2 = i2 + i3
			l = field[j][j2] + field[j + 1][j2 + 1] + field[j + 2][j2 + 2] + field[j + 3][j2 + 3] + field[j + 4][j2 + 4]
			if l.count('X') == 4 and l.count('.') == 1:
				print('YES')
				sys.exit()
	print('NO')
f()


a = ['$' * 12]
for i in range(10):
	a.append(list('$' + input() + '$'))
a.append('$' * 12)
flag = False

def count(r, c, dr, dc):
	k = 0
	while a[r][c] == 'X':
		(r, c) = (r + dr, c + dc)
		k += 1
	return k
for r in range(1, 11):
	for c in range(1, 11):
		if a[r][c] == '.':
			h = count(r, c - 1, 0, -1) + count(r, c + 1, 0, 1)
			v = count(r - 1, c, -1, 0) + count(r + 1, c, 1, 0)
			u = count(r + 1, c - 1, 1, -1) + count(r - 1, c + 1, -1, 1)
			d = count(r - 1, c - 1, -1, -1) + count(r + 1, c + 1, 1, 1)
			if h >= 4 or v >= 4 or u >= 4 or (d >= 4):
				flag = True
if flag == True:
	print('YES')
else:
	print('NO')


def check(r0, c0, dr, dc):
	cntx = 0
	cnte = 0
	for i in range(5):
		r = r0 + dr * i
		c = c0 + dc * i
		if r < 0 or 9 < r or c < 0 or (9 < c):
			break
		elif cells[r][c] == 'X':
			cntx += 1
		elif cells[r][c] == '.':
			cnte += 1
	return cntx == 4 and cnte == 1
cells = [list(input()) for _ in range(10)]
drc = [(1, 0), (0, 1), (1, 1), (1, -1)]
ans = 'NO'
for r0 in range(10):
	for c0 in range(10):
		for (dr, dc) in drc:
			if check(r0, c0, dr, dc):
				ans = 'YES'
print(ans)


k = []
for i in range(10):
	s = str(input())
	k.append(s)

def krestik(mast, nom_str, nom_symvol):
	x = 1
	y = 1
	z = 1
	v = 1
	if mast[nom_str][nom_symvol] == '.':
		lov = 1
	else:
		lov = 0
	if nom_symvol <= 5:
		for i in range(4):
			if mast[nom_str][nom_symvol + x] == 'X' or mast[nom_str][nom_symvol + x] == '.':
				if mast[nom_str][nom_symvol + x] == '.':
					lov += 1
				x += 1
				if x == 5 and lov == 1:
					return 'YES'
	if mast[nom_str][nom_symvol] == '.':
		lov = 1
	else:
		lov = 0
	if nom_str <= 5:
		for i in range(4):
			if mast[nom_str + y][nom_symvol] == 'X' or mast[nom_str + y][nom_symvol] == '.':
				if mast[nom_str + y][nom_symvol] == '.':
					lov += 1
				y += 1
				if y == 5 and lov == 1:
					return 'YES'
	if mast[nom_str][nom_symvol] == '.':
		lov = 1
	else:
		lov = 0
	if nom_str <= 5 and nom_symvol <= 5:
		for i in range(4):
			if mast[nom_str + z][nom_symvol + z] == 'X' or mast[nom_str + z][nom_symvol + z] == '.':
				if mast[nom_str + z][nom_symvol + z] == '.':
					lov += 1
				z += 1
				if z == 5 and lov == 1:
					return 'YES'
	if mast[nom_str][nom_symvol] == '.':
		lov = 1
	else:
		lov = 0
	if nom_str <= 5 and nom_symvol >= 4:
		for i in range(4):
			if mast[nom_str + v][nom_symvol - v] == 'X' or mast[nom_str + v][nom_symvol - v] == '.':
				if mast[nom_str + v][nom_symvol - v] == '.':
					lov += 1
				v += 1
				if v == 5 and lov == 1:
					return 'YES'
	return 'NO'

def vivod(mask):
	for i in range(10):
		for g in range(10):
			if mask[i][g] == 'X' or mask[i][g] == '.':
				if krestik(mask, i, g) == 'YES':
					return 'YES'
				if krestik(mask, i, g) == 'NO':
					continue
	return 'NO'
print(vivod(k))


def list_input():
	return list(map(int, input().split()))
n = 10
a = list()
for i in range(10):
	a.append(list(input()))
dr = [-1, -1, 0, 1, 1, 1, 0, -1]
dc = [0, 1, 1, 1, 0, -1, -1, -1]
for i in range(10):
	for j in range(10):
		x = a[i][j]
		if x != '.':
			continue
		a[i][j] = 'X'
		for ii in range(10):
			for jj in range(10):
				for k in range(8):
					r = ii + 4 * dr[k]
					c = jj + 4 * dc[k]
					if not (0 <= r and r < 10 and (0 <= c) and (c < 10)):
						continue
					ok = True
					for l in range(5):
						if a[ii + dr[k] * l][jj + dc[k] * l] != 'X':
							ok = False
							break
					if ok:
						print('YES')
						exit(0)
		a[i][j] = x
print('NO')


field = []
for _ in range(10):
	field.append(input())
rows = [row for row in field]
columns = []
for i in range(10):
	s = ''
	for j in range(10):
		s += field[j][i]
	columns.append(s)
maindiags = []
for k in range(-9, 10):
	s = ''
	if k >= 0:
		for i in range(10 - k):
			for j in range(k, 10):
				if i == j - k:
					s += field[i][j]
	else:
		for i in range(-k, 10):
			for j in range(10 + k):
				if i == j - k:
					s += field[i][j]
	maindiags.append(s)
diags = []
for k in range(-9, 10):
	s = ''
	if k >= 0:
		for i in range(k, 10):
			for j in range(k, 10):
				if i == 9 - j + k:
					s += field[i][j]
	else:
		for i in range(10 + k):
			for j in range(10 + k):
				if i == 9 - j + k:
					s += field[i][j]
	diags.append(s)

def answer(a):
	patterns = ['.XXXX', 'X.XXX', 'XX.XX', 'XXX.X', 'XXXX.']
	for elem in a:
		if len(elem) >= 5:
			for k in range(5):
				for i in range(len(elem) - 4):
					flag = True
					for j in range(5):
						if elem[i + j] != patterns[k][j]:
							flag = False
					if flag:
						return True
	return False
a = rows + columns + maindiags + diags
print('YES' if answer(a) else 'NO')


a = []
for i in range(10):
	s = input()
	a.append(s)
ans = 0
for i in range(10):
	for j in range(10):
		if a[i][j] == '.':
			k = i - 1
			c = 1
			while k >= 0 and a[k][j] == 'X':
				c += 1
				k -= 1
			k = i + 1
			while k < 10 and a[k][j] == 'X':
				c += 1
				k += 1
			if c >= 5:
				ans = 1
			k = j - 1
			c = 1
			while k >= 0 and a[i][k] == 'X':
				c += 1
				k -= 1
			k = j + 1
			while k < 10 and a[i][k] == 'X':
				c += 1
				k += 1
			if c >= 5:
				ans = 1
			k = i - 1
			l = j - 1
			c = 1
			while k >= 0 and l >= 0 and (a[k][l] == 'X'):
				c += 1
				k -= 1
				l -= 1
			k = i + 1
			l = j + 1
			while k < 10 and l < 10 and (a[k][l] == 'X'):
				c += 1
				k += 1
				l += 1
			if c >= 5:
				ans = 1
			k = i - 1
			l = j + 1
			c = 1
			while k >= 0 and l < 10 and (a[k][l] == 'X'):
				c += 1
				k -= 1
				l += 1
			k = i + 1
			l = j - 1
			while k < 10 and l >= 0 and (a[k][l] == 'X'):
				c += 1
				k += 1
				l -= 1
			if c >= 5:
				ans = 1
if ans:
	print('YES')
else:
	print('NO')


field = []
for i in range(10):
	s = input().strip()
	field.append(list(s))

def check(i, j):
	ti = i
	tj = j
	if i + 4 < 10:
		tics = set()
		for it in range(5):
			tics.add(field[ti][tj])
			ti += 1
		if len(tics) == 1:
			return True
	ti = i
	tj = j
	if j + 4 < 10:
		tics = set()
		for it in range(5):
			tics.add(field[ti][tj])
			tj += 1
		if len(tics) == 1:
			return True
	ti = i
	tj = j
	if i + 4 < 10 and j + 4 < 10:
		tics = set()
		for it in range(5):
			tics.add(field[ti][tj])
			ti += 1
			tj += 1
		if len(tics) == 1:
			return True
	ti = i
	tj = j
	if i - 4 >= 0 and j + 4 < 10:
		tics = set()
		for it in range(5):
			tics.add(field[ti][tj])
			ti -= 1
			tj += 1
		if len(tics) == 1:
			return True
	return False

def checkfield():
	for i in range(10):
		for j in range(10):
			if field[i][j] == 'X':
				if check(i, j):
					return True
	return False
result = False
for i in range(10):
	for j in range(10):
		if field[i][j] == '.':
			field[i][j] = 'X'
			if checkfield():
				result = True
				break
			field[i][j] = '.'
	if result:
		break
if result:
	print('YES')
else:
	print('NO')


a = []
for i in range(10):
	a.append(input())
for i in range(6):
	for j in range(6):
		(k, z) = (0, 0)
		for x in range(5):
			if a[i + x][j + x] == 'X':
				k += 1
			elif a[i + x][j + x] == '.':
				z += 1
		if k == 5 or (k == 4 and z == 1):
			print('YES')
			exit(0)
		(k, z) = (0, 0)
		for x in range(5):
			if a[i + x][j + 4 - x] == 'X':
				k += 1
			elif a[i + x][j + 4 - x] == '.':
				z += 1
		if k == 5 or (k == 4 and z == 1):
			print('YES')
			exit(0)
for i in range(10):
	for j in range(6):
		(k, z) = (0, 0)
		for x in range(5):
			if a[i][j + x] == 'X':
				k += 1
			elif a[i][j + x] == '.':
				z += 1
		if k == 5 or (k == 4 and z == 1):
			print('YES')
			exit(0)
for i in range(6):
	for j in range(10):
		(k, z) = (0, 0)
		for x in range(5):
			if a[i + x][j] == 'X':
				k += 1
			elif a[i + x][j] == '.':
				z += 1
		if k == 5 or (k == 4 and z == 1):
			print('YES')
			exit(0)
print('NO')


t = [input() for _ in range(10)]
import re
p = re.compile('.*X{5,}.*')
for i in range(10):
	for j in range(10):
		if t[i][j] != '.':
			continue
		z = t[i][:j] + 'X' + t[i][j + 1:]
		s = p.match(z)
		if s is not None:
			print('YES')
			exit()
tt = [''.join(i) for i in [*zip(*t)]]
for i in range(10):
	for j in range(10):
		if tt[i][j] != '.':
			continue
		z = tt[i][:j] + 'X' + tt[i][j + 1:]
		s = p.match(z)
		if s is not None:
			print('YES')
			exit()

def get_rows(grid):
	return [[c for c in r] for r in grid]

def get_cols(grid):
	return zip(*grid)

def get_backward_diagonals(grid):
	b = [None] * (len(grid) - 1)
	grid = [b[i:] + r + b[:i] for (i, r) in enumerate(get_rows(grid))]
	return [[c for c in r if c is not None] for r in get_cols(grid)]

def get_forward_diagonals(grid):
	b = [None] * (len(grid) - 1)
	grid = [b[:i] + r + b[i:] for (i, r) in enumerate(get_rows(grid))]
	return [[c for c in r if c is not None] for r in get_cols(grid)]
(d, ad) = (get_forward_diagonals(t), get_backward_diagonals(t))
for i in range(len(d)):
	for j in range(len(d[i])):
		t = ''.join(d[i])
		if t[j] != '.':
			continue
		z = t[:j] + 'X' + t[j + 1:]
		s = p.match(z)
		if s is not None:
			print('YES')
			exit()
for i in range(len(ad)):
	for j in range(len(ad[i])):
		t = ''.join(ad[i])
		if t[j] != '.':
			continue
		z = t[:j] + 'X' + t[j + 1:]
		s = p.match(z)
		if s is not None:
			print('YES')
			exit()
print('NO')


l = []
s = []
d = []
w = ''
r = 0
for i in range(0, 10):
	l.append(str(input()))
for i in l:
	for j in range(0, 6):
		if i[j:j + 5].count('X') == 4 and i[j:j + 5].count('.') == 1:
			r = 1
			break
if r != 1:
	for i in range(0, 10):
		for j in l:
			w = w + j[i]
		s.append(w)
		w = ''
	for i in s:
		for j in range(0, 6):
			if i[j:j + 5].count('X') == 4 and i[j:j + 5].count('.') == 1:
				r = 1
				break
	if r != 1:
		for i in range(0, 6):
			s = ''
			for j in range(0, 6):
				s = l[i][j] + l[i + 1][j + 1] + l[i + 2][j + 2] + l[i + 3][j + 3] + l[i + 4][j + 4]
				d.append(s)
				s = ''
				s = l[i][j + 4] + l[i + 1][j + 3] + l[i + 2][j + 2] + l[i + 3][j + 1] + l[i + 4][j]
				d.append(s)
		for i in d:
			if i.count('X') == 4 and i.count('.') == 1:
				r = 1
				break
if r == 1:
	print('YES')
else:
	print('NO')


a = []
f = False
for i in range(10):
	s = input()
	a.append(s)
	if s.find('XXXX.') != -1 or s.find('XXX.X') != -1 or s.find('XX.XX') != -1 or (s.find('X.XXX') != -1) or (s.find('.XXXX') != -1):
		f = True
for i in range(10):
	s = ''
	for j in range(10):
		s += a[j][i]
	if s.find('XXXX.') != -1 or s.find('XXX.X') != -1 or s.find('XX.XX') != -1 or (s.find('X.XXX') != -1) or (s.find('.XXXX') != -1):
		f = True
for k in range(10):
	s = ''
	for i in range(k + 1):
		s += a[i][k - i]
	if s.find('XXXX.') != -1 or s.find('XXX.X') != -1 or s.find('XX.XX') != -1 or (s.find('X.XXX') != -1) or (s.find('.XXXX') != -1):
		f = True
for k in range(10, 19):
	s = ''
	for i in range(k - 9, 10):
		s += a[i][k - i]
	if s.find('XXXX.') != -1 or s.find('XXX.X') != -1 or s.find('XX.XX') != -1 or (s.find('X.XXX') != -1) or (s.find('.XXXX') != -1):
		f = True
for k in range(-9, 0):
	s = ''
	for i in range(k + 10):
		s += a[i][i - k]
	if s.find('XXXX.') != -1 or s.find('XXX.X') != -1 or s.find('XX.XX') != -1 or (s.find('X.XXX') != -1) or (s.find('.XXXX') != -1):
		f = True
for k in range(10):
	s = ''
	for i in range(k, 10):
		s += a[i][i - k]
	if s.find('XXXX.') != -1 or s.find('XXX.X') != -1 or s.find('XX.XX') != -1 or (s.find('X.XXX') != -1) or (s.find('.XXXX') != -1):
		f = True
if f:
	print('YES')
else:
	print('NO')


m = []
for x in range(10):
	m.append(input())
t = False
for y in range(10):
	for x in range(10):
		if x < 6:
			if m[y][x + 1] == m[y][x + 2] == m[y][x + 3] == m[y][x + 4] == 'X' and m[y][x] != 'O':
				t = True
				break
		if x > 0 and x < 7:
			if m[y][x - 1] == m[y][x + 1] == m[y][x + 2] == m[y][x + 3] == 'X' and m[y][x] != 'O':
				t = True
				break
		if x > 1 and x < 8:
			if m[y][x - 1] == m[y][x - 2] == m[y][x + 1] == m[y][x + 2] == 'X' and m[y][x] != 'O':
				t = True
				break
		if x > 2 and x < 9:
			if m[y][x - 1] == m[y][x - 2] == m[y][x - 3] == m[y][x + 1] == 'X' and m[y][x] != 'O':
				t = True
				break
		if x > 3:
			if m[y][x - 1] == m[y][x - 2] == m[y][x - 3] == m[y][x - 4] == 'X' and m[y][x] != 'O':
				t = True
				break
		if x < 6 and y < 6:
			if m[y][x] != 'O' and m[y + 1][x + 1] == m[y + 2][x + 2] == m[y + 3][x + 3] == m[y + 4][x + 4] == 'X':
				t = True
				break
		if x < 7 and y < 7 and (x > 0) and (y > 0):
			if m[y][x] != 'O' and m[y - 1][x - 1] == m[y + 1][x + 1] == m[y + 2][x + 2] == m[y + 3][x + 3] == 'X':
				t = True
				break
		if x < 8 and y < 8 and (x > 1) and (y > 1):
			if m[y][x] != 'O' and m[y - 1][x - 1] == m[y - 2][x - 2] == m[y + 1][x + 1] == m[y + 2][x + 2] == 'X':
				t = True
				break
		if x < 9 and y < 9 and (x > 2) and (y > 2):
			if m[y][x] != 'O' and m[y - 1][x - 1] == m[y - 2][x - 2] == m[y - 3][x - 3] == m[y + 1][x + 1] == 'X':
				t = True
				break
		if x > 3 and y > 3:
			if m[y][x] != 'O' and m[y - 1][x - 1] == m[y - 2][x - 2] == m[y - 3][x - 3] == m[y - 4][x - 4] == 'X':
				t = True
				break
		if x > 3 and y < 6:
			if m[y][x] != 'O' and m[y + 1][x - 1] == m[y + 2][x - 2] == m[y + 3][x - 3] == m[y + 4][x - 4] == 'X':
				t = True
				break
		if x > 2 and y < 7 and (x < 9) and (y > 0):
			if m[y][x] != 'O' and m[y - 1][x + 1] == m[y + 1][x - 1] == m[y + 2][x - 2] == m[y + 3][x - 3] == 'X':
				t = True
				break
		if x > 1 and y < 8 and (x < 8) and (y > 1):
			if m[y][x] != 'O' and m[y + 1][x - 1] == m[y + 2][x - 2] == m[y - 1][x + 1] == m[y - 2][x + 2] == 'X':
				t = True
				break
		if x > 0 and y < 9 and (x < 7) and (y > 2):
			if m[y][x] != 'O' and m[y + 1][x - 1] == m[y - 1][x + 1] == m[y - 2][x + 2] == m[y - 3][x + 3] == 'X':
				t = True
				break
		if x < 6 and y > 3:
			if m[y][x] != 'O' and m[y - 1][x + 1] == m[y - 2][x + 2] == m[y - 3][x + 3] == m[y - 4][x + 4] == 'X':
				t = True
				break
		if y < 6:
			if m[y + 1][x] == m[y + 2][x] == m[y + 3][x] == m[y + 4][x] == 'X' and m[y][x] != 'O':
				t = True
				break
		if y > 0 and y < 7:
			if m[y - 1][x] == m[y + 1][x] == m[y + 2][x] == m[y + 3][x] == 'X' and m[y][x] != 'O':
				t = True
				break
		if y > 1 and y < 8:
			if m[y - 1][x] == m[y - 2][x] == m[y + 1][x] == m[y + 2][x] == 'X' and m[y][x] != 'O':
				t = True
				break
		if y > 2 and y < 9:
			if m[y - 1][x] == m[y - 2][x] == m[y - 3][x] == m[y + 1][x] == 'X' and m[y][x] != 'O':
				t = True
				break
		if y > 3:
			if m[y - 1][x] == m[y - 2][x] == m[y - 3][x] == m[y - 4][x] == 'X' and m[y][x] != 'O':
				t = True
				break
if t == False:
	print('NO')
else:
	print('YES')


import copy

def check1():
	for i in range(5):
		if board[m][k + i] != 'X':
			return False
	return True

def check2():
	for i in range(5):
		if board[m + i][k] != 'X':
			return False
	return True

def check3():
	for i in range(5):
		if board[m + i][k + i] != 'X':
			return False
	return True

def check4():
	for i in range(5):
		if board[m + i][k - i] != 'X':
			return False
	return True
board = []
for _ in range(10):
	board.append(list(input()))
old_board = copy.deepcopy(board)
for i in range(10):
	for j in range(10):
		if board[i][j] == '.':
			board[i][j] = 'X'
			for m in range(6):
				for k in range(10):
					if check2():
						print('YES')
						exit(0)
			for m in range(10):
				for k in range(6):
					if check1():
						print('YES')
						exit(0)
			for m in range(6):
				for k in range(6):
					if check3():
						print('YES')
						exit(0)
			for m in range(6):
				for k in range(4, 10):
					if check4():
						print('YES')
						exit(0)
			board = copy.deepcopy(old_board)
print('NO')


a = [[x for x in input()] for i in range(10)]

def f():
	global a
	for i in range(10):
		for j in range(6):
			q = 0
			for k in range(5):
				q += int(a[i][j + k] == 'X')
			if q == 5:
				return 1
	for j in range(10):
		for i in range(6):
			q = 0
			for k in range(5):
				q += int(a[i + k][j] == 'X')
			if q == 5:
				return 1
	for i in range(6):
		for j in range(6):
			q = 0
			for k in range(5):
				q += int(a[i + k][j + k] == 'X')
			if q == 5:
				return 1
	return 0
fl = 0
for i in range(10):
	for j in range(10):
		if a[i][j] == '.':
			a[i][j] = 'X'
			if f():
				fl = 1
			a[i][j] = '.'
for i in range(10):
	a[i] = list(reversed(a[i]))
for i in range(10):
	for j in range(10):
		if a[i][j] == '.':
			a[i][j] = 'X'
			if f():
				fl = 1
			a[i][j] = '.'
if fl:
	print('YES')
else:
	print('NO')


s = []
f = False
for i in range(10):
	s.append(list(input()))
for i in range(6):
	for j in range(6):
		a = [s[i][j], s[i][j + 1], s[i][j + 2], s[i][j + 3], s[i][j + 4]]
		b = [s[i][j], s[i + 1][j + 1], s[i + 2][j + 2], s[i + 3][j + 3], s[i + 4][j + 4]]
		c = [s[i][j], s[i + 1][j], s[i + 2][j], s[i + 3][j], s[i + 4][j]]
		d = [s[i + 4][j], s[i + 4][j + 1], s[i + 4][j + 2], s[i + 4][j + 3], s[i + 4][j + 4]]
		e = [s[i + 4][j], s[i + 3][j + 1], s[i + 2][j + 2], s[i + 1][j + 3], s[i][j + 4]]
		g = [s[i][j + 4], s[i + 1][j + 4], s[i + 2][j + 4], s[i + 3][j + 4], s[i + 4][j + 4]]
		if a.count('X') == 4 and a.count('.') == 1 or (b.count('X') == 4 and b.count('.') == 1) or (c.count('X') == 4 and c.count('.') == 1) or (d.count('X') == 4 and d.count('.') == 1) or (e.count('X') == 4 and e.count('.') == 1) or (g.count('X') == 4 and g.count('.') == 1):
			f = True
			break
if f:
	print('YES')
else:
	print('NO')


def check(par):
	if par.find('.XXXX') != -1 or par.find('X.XXX') != -1 or par.find('XX.XX') != -1 or (par.find('XXX.X') != -1) or (par.find('XXXX.') != -1):
		print('YES')
		quit()
arr = []
for i in range(10):
	arr.append(input())
for string in arr:
	check(string)
rarr = []
for a in range(10):
	string = ''
	for b in range(10):
		string += arr[b][a]
	rarr.append(string)
for string in rarr:
	check(string)
aarr = []
for a in range(4, 10):
	(b, c) = (0, a)
	string = ''
	while True:
		string += arr[b][c]
		if b == a and (not c):
			break
		b += 1
		c -= 1
	aarr.append(string)
for string in aarr:
	check(string)
barr = []
a = 1
while True:
	(b, c) = (a, 9)
	string = ''
	while True:
		string += arr[b][c]
		if b == 9 and c == a:
			break
		b += 1
		c -= 1
	barr.append(string)
	if a == 5:
		break
	a += 1
	b -= 1
for string in barr:
	check(string)
carr = []
for a in range(6):
	(b, c) = (a, 0)
	string = ''
	while True:
		string += arr[b][c]
		if b == 9 and c == 9 - a:
			break
		b += 1
		c += 1
	carr.append(string)
for string in carr:
	check(string)
darr = []
for a in range(1, 7):
	(b, c) = (a, 0)
	string = ''
	while True:
		string += arr[c][b]
		if b == 9 and c == 9 - a:
			break
		b += 1
		c += 1
	darr.append(string)
for string in darr:
	check(string)
print('NO')


a = [list(input()) for i in range(10)]
flag = True
for i in range(10):
	for j in range(10):
		(l, r) = (j - 1, j + 1)
		cnt_lr = 0
		while 0 <= l and a[i][l] == 'X':
			l -= 1
			cnt_lr += 1
		while r < 10 and a[i][r] == 'X':
			r += 1
			cnt_lr += 1
		(d, u) = (i - 1, i + 1)
		cnt_du = 0
		while 0 <= d and a[d][j] == 'X':
			d -= 1
			cnt_du += 1
		while u < 10 and a[u][j] == 'X':
			u += 1
			cnt_du += 1
		(ld, ru) = (1, 1)
		cnt_ld_ru = 0
		while i - ld >= 0 and j - ld >= 0 and (a[i - ld][j - ld] == 'X'):
			cnt_ld_ru += 1
			ld += 1
		while i + ru < 10 and j + ru < 10 and (a[i + ru][j + ru] == 'X'):
			cnt_ld_ru += 1
			ru += 1
		(lu, rd) = (1, 1)
		cnt_lu_rd = 0
		while i + lu < 10 and j - lu >= 0 and (a[i + lu][j - lu] == 'X'):
			cnt_lu_rd += 1
			lu += 1
		while i - rd >= 0 and j + rd < 10 and (a[i - rd][j + rd] == 'X'):
			cnt_lu_rd += 1
			rd += 1
		if (cnt_lr >= 4 or cnt_du >= 4 or cnt_ld_ru >= 4 or (cnt_lu_rd >= 4)) and a[i][j] == '.':
			print('YES')
			exit()
print('NO')


import sys
dx = [0, 1, 1, 1]
dy = [1, 1, 0, -1]
range_x = set(range(10))
range_y = set(range(10))

def is_win(board):
	for i in range(10):
		for j in range(10):
			for dir in range(len(dx)):
				for k in range(5):
					new_x = i + k * dx[dir]
					new_y = j + k * dy[dir]
					if not (new_x in range_x and new_y in range_y and (board[new_x][new_y] == 'X')):
						break
				else:
					return True
	return False
board = sys.stdin.read().split()
for _ in range(10):
	for __ in range(10):
		if board[_][__] == '.':
			board[_] = board[_][:__] + 'X' + board[_][__ + 1:]
			if is_win(board):
				break
			board[_] = board[_][:__] + '.' + board[_][__ + 1:]
	else:
		continue
	break
else:
	print('NO')
	sys.exit(0)
print('YES')


import sys
input = sys.stdin.readline
g = [list(input().strip()) for _ in range(10)]
ans = 0
for i in range(10):
	for j in range(10):
		if g[i][j] != '.':
			continue
		g[i][j] = 'X'
		for p in range(10):
			for q in range(10):
				if p + 4 < 10:
					cnt = 0
					for r in range(5):
						if g[p + r][q] == 'X':
							cnt += 1
					if cnt == 5:
						ans = 1
				if q + 4 < 10:
					cnt = 0
					for r in range(5):
						if g[p][q + r] == 'X':
							cnt += 1
					if cnt == 5:
						ans = 1
				if p + 4 < 10 and q + 4 < 10:
					cnt = 0
					for r in range(5):
						if g[p + r][q + r] == 'X':
							cnt += 1
					if cnt == 5:
						ans = 1
					cnt = 0
					for r in range(5):
						if g[p + 4 - r][q + r] == 'X':
							cnt += 1
					if cnt == 5:
						ans = 1
		g[i][j] = '.'
print('YES' if ans else 'NO')


A = [list(input()) for i in range(10)]
for i in range(10):
	A[i] += ['O'] * 5
for i in range(5):
	A.insert(0, ['O'] * 15)
	A.append(['O'] * 15)
D = [(1, 0), (0, 1), (1, 1), (-1, 1)]
flag = False
for i in range(5, 15):
	for j in range(10):
		if A[i][j] == 'X' or A[i][j + 1] == 'X' or A[i + 1][j] == 'X' or (A[i + 1][j + 1] == 'X') or (A[i - 1][j + 1] == 'X'):
			cnt = [0, 0, 0, 0]
			for k in range(5):
				for (n, d) in enumerate(D):
					dx = k * d[0]
					dy = k * d[1]
					if A[i + dx][j + dy] == 'X':
						cnt[n] += 1
					if A[i + dx][j + dy] == 'O':
						cnt[n] = -10
			for c in cnt:
				if c == 4:
					flag = True
					break
		if flag == True:
			break
	if flag == True:
		break
if flag == True:
	print('YES')
else:
	print('NO')


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
a = []
for i in range(10):
	a.append(input())
win = {'XXXX.', 'XXX.X', 'XX.XX', 'X.XXX', '.XXXX'}
for i in range(10):
	for j in range(10):
		(r, c, d1, d2) = ('', '', '', '')
		for k in range(5):
			if j + k < 10:
				r += a[i][j + k]
			if i + k < 10:
				c += a[i + k][j]
			if i + k < 10 and j + k < 10:
				d1 += a[i + k][j + k]
			if i + k < 10 and j - k >= 0:
				d2 += a[i + k][j - k]
		if win.intersection({r, c, d1, d2}) != set():
			print('YES')
			exit()
print('NO')


def is_win(x):
	if x.count('X') == 4 and x.count('.') == 1:
		return True
	else:
		return False

def solve(L):
	for x in L:
		for j in range(6):
			if is_win(x[j:j + 5]):
				return 'YES'
	LT = []
	for i in range(10):
		s = ''
		for j in range(10):
			s += L[j][i]
		LT.append(s)
	for x in LT:
		for j in range(6):
			if is_win(x[j:j + 5]):
				return 'YES'
	for i in range(2, 8):
		for j in range(2, 8):
			x = L[i - 2][j - 2] + L[i - 1][j - 1] + L[i][j] + L[i + 1][j + 1] + L[i + 2][j + 2]
			if is_win(x):
				return 'YES'
			x = L[i - 2][j + 2] + L[i - 1][j + 1] + L[i][j] + L[i + 1][j - 1] + L[i + 2][j - 2]
			if is_win(x):
				return 'YES'
	return 'NO'
L = []
for i in range(10):
	L.append(input())
print(solve(L))


input_data_set1 = [input() for s in range(0, 10)]
patterns = ['.XXXX', 'X.XXX', 'XX.XX', 'XXX.X', 'XXXX.']

def check_data_set(data_set, patterns):
	win_flag = 'NO'
	for row in data_set:
		for pattern in patterns:
			if row.find(pattern) != -1:
				win_flag = 'YES'
	return win_flag

def get_diagonal_data_set(source_data_set):
	diagonal_data_set_1 = []
	diagonal_data_set_2 = []
	for i in range(0, 6):
		diagonal_data_set_1.append('')
		diagonal_data_set_2.append('')
		for j in range(0, 10 - i):
			diagonal_data_set_1[i] += source_data_set[j][j + i]
			diagonal_data_set_2[i] += source_data_set[j + i][j]
	return diagonal_data_set_1 + diagonal_data_set_2
horizontal_data_set = input_data_set1
vertical_data_set = []
for i in range(0, 10):
	vertical_data_set.append('')
	for j in range(0, 10):
		vertical_data_set[i] += horizontal_data_set[j][i]
data_set = horizontal_data_set + vertical_data_set + get_diagonal_data_set(horizontal_data_set) + get_diagonal_data_set(vertical_data_set[::-1])
print(check_data_set(data_set, patterns))


def main():
	Map = []
	for i in range(10):
		Map += [input()]
	for i in range(10):
		for j in range(10):
			count = 0
			count2 = 0
			if i <= 5:
				for k in range(5):
					if Map[i + k][j] == 'X':
						count += 1
					elif Map[i + k][j] == '.':
						count2 += 1
				if count == 4 and count2 == 1:
					print('YES')
					return 0
			count = 0
			count2 = 0
			if j <= 5:
				for k in range(5):
					if Map[i][j + k] == 'X':
						count += 1
					elif Map[i][j + k] == '.':
						count2 += 1
				if count == 4 and count2 == 1:
					print('YES')
					return 0
			count = 0
			count2 = 0
			if i <= 5 and j <= 5:
				for k in range(5):
					if Map[i + k][j + k] == 'X':
						count += 1
					elif Map[i + k][j + k] == '.':
						count2 = 1
				if count == 4 and count2 == 1:
					print('YES')
					return 0
			count = 0
			count2 = 0
			if i >= 4 and j <= 5:
				count = 0
				for k in range(5):
					if Map[i - k][j + k] == 'X':
						count += 1
					elif Map[i - k][j + k] == 'O':
						count -= 1
				if count == 4:
					print('YES')
					return 0
	print('NO')
	return 0
main()


a = [0 for i in range(10)]
for i in range(10):
	a[i] = input()
b = [[0 for i in range(10)] for i in range(10)]
f = False
for x1 in range(10):
	for y1 in range(10):
		for i in range(10):
			for j in range(10):
				b[i][j] = a[i][j]
		if b[x1][y1] == '.':
			b[x1][y1] = 'X'
		can = False
		for i in range(10):
			for j in range(10):
				if j < 6 and b[i][j] == 'X' and (b[i][j + 1] == 'X') and (b[i][j + 2] == 'X') and (b[i][j + 3] == 'X') and (b[i][j + 4] == 'X'):
					can = True
				if i < 6 and b[i][j] == 'X' and (b[i + 1][j] == 'X') and (b[i + 2][j] == 'X') and (b[i + 3][j] == 'X') and (b[i + 4][j] == 'X'):
					can = True
				if i < 6 and j < 6 and (b[i][j] == 'X') and (b[i + 1][j + 1] == 'X') and (b[i + 2][j + 2] == 'X') and (b[i + 3][j + 3] == 'X') and (b[i + 4][j + 4] == 'X'):
					can = True
				if i < 6 and j > 3 and (b[i][j] == 'X') and (b[i + 1][j - 1] == 'X') and (b[i + 2][j - 2] == 'X') and (b[i + 3][j - 3] == 'X') and (b[i + 4][j - 4] == 'X'):
					can = True
		if can == True:
			f = True
if f:
	print('YES')
else:
	print('NO')


l = [''] * 12
flag = False
for i in range(10):
	x = input()
	cnt = int(0)
	if 'XX.XX' in x or 'X.XXX' in x or '.XXXX' in x or ('XXX.X' in x) or ('XXXX.' in x):
		flag = True
	x = list(x)
	for j in range(10):
		l[j] += x[j]
for i in range(12):
	x = ''.join(l[i])
	cnt = int(0)
	if 'XX.XX' in x or 'X.XXX' in x or '.XXXX' in x or ('XXX.X' in x) or ('XXXX.' in x):
		flag = True
for i in range(10):
	for j in range(10):
		a = ''
		if i >= 4 and j >= 4:
			a += l[i][j] + l[i - 1][j - 1] + l[i - 2][j - 2] + l[i - 3][j - 3] + l[i - 4][j - 4]
		if 'XX.XX' in x or 'X.XXX' in x or '.XXXX' in x or ('XXX.X' in x) or ('XXXX.' in x):
			flag = True
		x = ''
		if i <= 5 and j <= 5:
			x += l[i][j] + l[i + 1][j + 1] + l[i + 2][j + 2] + l[i + 3][j + 3] + l[i + 4][j + 4]
		if 'XX.XX' in x or 'X.XXX' in x or '.XXXX' in x or ('XXX.X' in x) or ('XXXX.' in x):
			flag = True
		x = ''
		if i <= 5 and j >= 4:
			x += l[i][j] + l[i + 1][j - 1] + l[i + 2][j - 2] + l[i + 3][j - 3] + l[i + 4][j - 4]
		if 'XX.XX' in x or 'X.XXX' in x or '.XXXX' in x or ('XXX.X' in x) or ('XXXX.' in x):
			flag = True
		x = ''
		if i >= 4 and j <= 5:
			x += l[i][j] + l[i - 1][j + 1] + l[i - 2][j + 2] + l[i - 3][j + 3] + l[i - 4][j + 4]
		if 'XX.XX' in x or 'X.XXX' in x or '.XXXX' in x or ('XXX.X' in x) or ('XXXX.' in x):
			flag = True
print('YES' if flag == True else 'NO')


l = [input() for _ in range(10)]
for c in range(5):
	t = ['X'] * 5
	t[c] = '.'
	for i in range(10):
		for j in range(6):
			cnt = 0
			for k in range(5):
				if l[i][j + k] == '.':
					cnt += 1
				elif l[i][j + k] == 'O':
					cnt += 2
			if cnt == 1:
				print('YES')
				exit()
	for i in range(6):
		for j in range(10):
			cnt = 0
			for k in range(5):
				if l[i + k][j] == '.':
					cnt += 1
				elif l[i + k][j] == 'O':
					cnt += 2
			if cnt == 1:
				print('YES')
				exit()
	for i in range(6):
		for j in range(6):
			cnt = 0
			for k in range(5):
				if l[i + k][j + k] == '.':
					cnt += 1
				elif l[i + k][j + k] == 'O':
					cnt += 2
			if cnt == 1:
				print('YES')
				exit()
	for i in range(4, 10):
		for j in range(6):
			cnt = 0
			for k in range(5):
				if l[i - k][j + k] == '.':
					cnt += 1
				elif l[i - k][j + k] == 'O':
					cnt += 2
			if cnt == 1:
				print('YES')
				exit()
print('NO')


mat1 = [input() for l in range(10)]
mat2 = list(reversed(mat1))
mat3 = []
for l in mat1:
	mat3.append(l[::-1])

def horizontal(inp, i, j):
	s = ''
	for k in range(j, j + 5):
		s = s + inp[i][k]
	return s

def vertical(inp, i, j):
	s = ''
	for k in range(i, i + 5):
		s = s + inp[k][j]
	return s

def diagonal(inp, i, j):
	first = range(i, i + 5, 1)
	second = range(j, j + 5, 1)
	s = ''
	for (k, l) in zip(first, second):
		s += inp[k][l]
	return s

def checker(s):
	if '0' in s:
		return False
	elif s.count('X') < 4:
		return False
	elif '.' not in s:
		return False
	return True

def solve(mat):
	for i in range(6):
		for j in range(6):
			if checker(horizontal(mat, i, j)):
				return True
			if checker(vertical(mat, i, j)):
				return True
			if checker(diagonal(mat, i, j)):
				return True
	return False
a = solve(mat1)
b = solve(mat2)
c = solve(mat3)
if a or b or c:
	print('YES')
else:
	print('NO')


def solve():
	grid = [input() for r in range(10)]

	def win(arr):
		return arr.count('X') == 4 and arr.count('.') == 1
	for i in range(10):
		for j in range(10):
			if win(grid[i][j:j + 5]):
				return True
			elif win([grid[k][j] for k in range(i, min(i + 5, 10))]):
				return True
			elif win([grid[i + k][j + k] for k in range(min(5, 10 - i, 10 - j))]):
				return True
			elif win([grid[i + k][j - k] for k in range(min(5, j + 1, 10 - i))]):
				return True
	return False
if solve():
	print('YES')
else:
	print('NO')


ar = []
for i in range(10):
	ar.append(input())
ans = False
for i in range(10):
	for j in range(10):
		if ar[i][j] == 'X':
			x = 1
			hl = False
			for k in range(1, 5):
				if i + k == 10:
					break
				if ar[i + k][j] == 'X':
					x += 1
				elif ar[i + k][j] == 'O':
					break
				elif hl:
					break
				else:
					hl = True
				if x == 4:
					if hl:
						ans = True
					elif i - 1 >= 0 and ar[i - 1][j] == '.' or (i + k + 1 < 10 and ar[i + k + 1][j] == '.'):
						ans = True
					break
			if ans:
				break
			x = 1
			hl = False
			for k in range(1, 5):
				if i + k == 10 or j + k == 10:
					break
				if ar[i + k][j + k] == 'X':
					x += 1
				elif ar[i + k][j + k] == 'O':
					break
				elif hl:
					break
				else:
					hl = True
				if x == 4:
					if hl:
						ans = True
					elif i - 1 >= 0 and j - 1 >= 0 and (ar[i - 1][j - 1] == '.') or (i + k + 1 < 10 and j + k + 1 < 10 and (ar[i + k + 1][j + k + 1] == '.')):
						ans = True
					break
			if ans:
				break
			x = 1
			hl = False
			for k in range(1, 5):
				if j + k == 10:
					break
				if ar[i][j + k] == 'X':
					x += 1
				elif ar[i][j + k] == 'O':
					break
				elif hl:
					break
				else:
					hl = True
				if x == 4:
					if hl:
						ans = True
					elif j - 1 >= 0 and ar[i][j - 1] == '.' or (j + k + 1 < 10 and ar[i][j + k + 1] == '.'):
						ans = True
					break
			if ans:
				break
			x = 1
			hl = False
			for k in range(1, 5):
				if i - k == -1 or j + k == 10:
					break
				if ar[i - k][j + k] == 'X':
					x += 1
				elif ar[i - k][j + k] == 'O':
					break
				elif hl:
					break
				else:
					hl = True
				if x == 4:
					if hl:
						ans = True
					elif i + 1 < 10 and j - 1 >= 0 and (ar[i + 1][j - 1] == '.') or (i - k - 1 >= 0 and j + k + 1 < 10 and (ar[i - k - 1][j + k + 1] == '.')):
						ans = True
					break
			if ans:
				break
	if ans:
		break
if ans:
	print('YES')
else:
	print('NO')


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
a = []
for i in range(10):
	a.append(input())
win = {'XXXX.', 'XXX.X', 'XX.XX', 'X.XXX', '.XXXX'}
for i in range(10):
	for j in range(10):
		(r, c, d1, d2) = ('', '', '', '')
		for k in range(5):
			if j + k < 10:
				r += a[i][j + k]
			if i + k < 10:
				c += a[i + k][j]
			if i + k < 10 and j + k < 10:
				d1 += a[i + k][j + k]
			if i + k < 10 and j - k >= 0:
				d2 += a[i + k][j - k]
		if win.intersection({r, c, d1, d2}) != set():
			print('YES')
			exit()
print('NO')


s = []
h = 0
h1 = 0
z = 0
x = 0
f1 = 0
while h < 10:
	a = list(input())
	s.append(a)
	a = []
	h = h + 1
while h1 < 60:
	w = s[z][x] + s[z][x + 1] + s[z][x + 2] + s[z][x + 3] + s[z][x + 4]
	if w.count('X') == 4 and w.count('.') == 1:
		f1 = 1
		break
	x = x + 1
	if x == 6:
		z = z + 1
		x = 0
	h1 = h1 + 1
h1 = 0
z = 0
x = 0
if f1 == 0:
	while h1 < 60:
		w = s[z][x] + s[z + 1][x] + s[z + 2][x] + s[z + 3][x] + s[z + 4][x]
		if w.count('X') == 4 and w.count('.') == 1:
			f1 = 1
			break
		z = z + 1
		if z == 6:
			x = x + 1
			z = 0
		h1 = h1 + 1
h1 = 0
z = 0
x = 0
if f1 == 0:
	while h1 < 36:
		w = s[z][x] + s[z + 1][x + 1] + s[z + 2][x + 2] + s[z + 3][x + 3] + s[z + 4][x + 4]
		if w.count('X') == 4 and w.count('.') == 1:
			f1 = 1
			break
		x = x + 1
		if x == 6:
			z = z + 1
			x = 0
		h1 = h1 + 1
h1 = 0
z = 0
x = 0
s.reverse()
if f1 == 0:
	while h1 < 36:
		w = s[z][x] + s[z + 1][x + 1] + s[z + 2][x + 2] + s[z + 3][x + 3] + s[z + 4][x + 4]
		if w.count('X') == 4 and w.count('.') == 1:
			f1 = 1
			break
		x = x + 1
		if x == 6:
			z = z + 1
			x = 0
		h1 = h1 + 1
if f1 == 0:
	print('NO')
if f1 == 1:
	print('YES')


s = [[c for c in input()] for i in range(10)]

def win():
	for i in range(10):
		for j in range(10):
			ok = True
			for k in range(5):
				if j + k > 9:
					ok = False
				elif s[i][j + k] != 'X':
					ok = False
			if ok:
				return True
			ok = True
			for k in range(5):
				if i + k > 9:
					ok = False
				elif s[i + k][j] != 'X':
					ok = False
			if ok:
				return True
			ok = True
			for k in range(5):
				if j + k > 9 or i + k > 9:
					ok = False
				elif s[i + k][j + k] != 'X':
					ok = False
			if ok:
				return True
			ok = True
			for k in range(5):
				if i - k < 0 or j + k > 9:
					ok = False
				elif s[i - k][j + k] != 'X':
					ok = False
			if ok:
				return True
	return False
for i in range(10):
	for j in range(10):
		if s[i][j] == '.':
			s[i][j] = 'X'
			if win():
				print('YES')
				return
			s[i][j] = '.'
print('NO')


s = 10 * [0]
for i in range(10):
	s[i] = input()

def trav(i, j, s, n):
	if n == 1:
		if i < 9:
			if s[i + 1][j] == 'X':
				return 1 + trav(i + 1, j, s, n)
			return 0
		return 0
	if n == -1:
		if i > 0:
			if s[i - 1][j] == 'X':
				return 1 + trav(i - 1, j, s, n)
			return 0
		return 0
	if n == 2:
		if j < 9:
			if s[i][j + 1] == 'X':
				return 1 + trav(i, j + 1, s, n)
			return 0
		return 0
	if n == -2:
		if j > 0:
			if s[i][j - 1] == 'X':
				return 1 + trav(i, j - 1, s, n)
			return 0
		return 0
	if n == 3:
		if i < 9 and j < 9:
			if s[i + 1][j + 1] == 'X':
				return 1 + trav(i + 1, j + 1, s, n)
			return 0
		return 0
	if n == -3:
		if i > 0 and j > 0:
			if s[i - 1][j - 1] == 'X':
				return 1 + trav(i - 1, j - 1, s, n)
			return 0
		return 0
	if n == 4:
		if i > 0 and j < 9:
			if s[i - 1][j + 1] == 'X':
				return 1 + trav(i - 1, j + 1, s, n)
			return 0
		return 0
	if n == -4:
		if i < 9 and j > 0:
			if s[i + 1][j - 1] == 'X':
				return 1 + trav(i + 1, j - 1, s, n)
			return 0
		return 0
flag = False
for i in range(10):
	for j in range(10):
		if s[i][j] == '.':
			if trav(i, j, s, 1) + trav(i, j, s, -1) >= 4 or trav(i, j, s, 2) + trav(i, j, s, -2) >= 4 or trav(i, j, s, 3) + trav(i, j, s, -3) >= 4 or (trav(i, j, s, 4) + trav(i, j, s, -4) >= 4):
				flag = True
				print('YES')
				break
	if flag:
		break
if not flag:
	print('NO')


a = [['', '', '', '', '', '', '', '', '', '', '', '', '', ''], ['', '', '', '', '', '', '', '', '', '', '', '', '', '']]
for i in range(10):
	a.append(list('  ' + input() + '  '))
a.append(['', '', '', '', '', '', '', '', '', '', '', '', '', ''])
a.append(['', '', '', '', '', '', '', '', '', '', '', '', '', ''])
for i in range(2, 12):
	for ii in range(2, 12):
		if a[i][ii] == '.':
			a[i][ii] = 'X'
			toch = ii
			st = i
			kek = 0
			while a[st][toch] == 'X':
				toch += 1
				kek += 1
			toch = ii - 1
			while a[st][toch] == 'X':
				toch -= 1
				kek += 1
			if kek >= 5:
				print('YES')
				exit()
			toch = ii
			kek = 0
			while a[st][toch] == 'X':
				st += 1
				kek += 1
			st = i - 1
			while a[st][toch] == 'X':
				st -= 1
				kek += 1
			if kek >= 5:
				print('YES')
				exit()
			kek = 0
			st = i
			while a[st][toch] == 'X':
				toch += 1
				st += 1
				kek += 1
			toch = ii - 1
			st = i - 1
			while a[st][toch] == 'X':
				toch -= 1
				st -= 1
				kek += 1
			if kek >= 5:
				print('YES')
				exit()
			kek = 0
			toch = ii
			st = i
			while a[st][toch] == 'X':
				toch += 1
				st -= 1
				kek += 1
			toch = ii - 1
			st = i + 1
			while a[st][toch] == 'X':
				toch -= 1
				st += 1
				kek += 1
			if kek >= 5:
				print('YES')
				exit()
			a[i][ii] = '.'
else:
	print('NO')


def check(a, b):
	if m[a][b] != '.':
		return False
	else:
		cnt = 0
		p = a + 1
		while p < 10 and m[p][b] == 'X':
			p += 1
			cnt += 1
		p = a - 1
		while p >= 0 and m[p][b] == 'X':
			p -= 1
			cnt += 1
		if cnt >= 4:
			return True
		cnt = 0
		p = b + 1
		while p < 10 and m[a][p] == 'X':
			p += 1
			cnt += 1
		p = b - 1
		while p >= 0 and m[a][p] == 'X':
			p -= 1
			cnt += 1
		if cnt >= 4:
			return True
		cnt = 0
		p = 1
		while a + p < 10 and b + p < 10 and (m[a + p][b + p] == 'X'):
			p += 1
			cnt += 1
		p = -1
		while a + p >= 0 and b + p >= 0 and (m[a + p][b + p] == 'X'):
			p -= 1
			cnt += 1
		if cnt >= 4:
			return True
		cnt = 0
		p = 1
		while a + p < 10 and b - p >= 0 and (m[a + p][b - p] == 'X'):
			p += 1
			cnt += 1
		p = -1
		while a + p >= 0 and b - p < 10 and (m[a + p][b - p] == 'X'):
			p -= 1
			cnt += 1
		if cnt >= 4:
			return True
	return False
m = []
for i in range(10):
	m.append(input())
F = False
for i in range(10):
	for j in range(10):
		if check(i, j):
			F = True
if F:
	print('YES')
else:
	print('NO')


t = []
for i in range(10):
	t.append(input())
for i in range(10):
	s = ''
	for j in range(10):
		s = s + t[j][i]
	t.append(s)
for i in range(6):
	s = ''
	for j in range(10 - i):
		s = s + t[i + j][j]
	t.append(s)
for i in range(1, 6):
	s = ''
	for j in range(10 - i):
		s = s + t[j][i + j]
	t.append(s)
for i in range(6):
	s = ''
	for j in range(10 - i):
		s = s + t[i + j][9 - j]
	t.append(s)
for i in range(1, 6):
	s = ''
	for j in range(10 - i):
		s = s + t[j][9 - j - i]
	t.append(s)
for line in t:
	(x, o, dot, f) = (0, 0, 0, 0)
	for i in range(5):
		if line[i] == 'X':
			x += 1
		elif line[i] == 'O':
			o += 1
		elif line[i] == '.':
			dot += 1
		if x == 4 and dot == 1:
			print('YES')
			f = 1
			break
	if f:
		break
	for i in range(5, len(line)):
		if line[i - 5] == 'X':
			x -= 1
		elif line[i - 5] == 'O':
			o -= 1
		elif line[i - 5] == '.':
			dot -= 1
		if line[i] == 'X':
			x += 1
		elif line[i] == 'O':
			o += 1
		elif line[i] == '.':
			dot += 1
		if x == 4 and dot == 1:
			print('YES')
			f = 1
			break
	if f:
		break
if not f:
	print('NO')


grid = []
for i in range(10):
	grid.append(input())
s2 = set(list(map(tuple, '.XXXX X.XXX XX.XX XXX.X XXXX.'.split())))
s = set()
for i in range(10):
	for j in range(10):
		(r, d, d1, d2) = (None, None, None, None)
		if j + 4 < 10:
			r = tuple([grid[i][j + x] for x in range(5)])
		if i + 4 < 10:
			d = tuple([grid[i + x][j] for x in range(5)])
		if i + 4 < 10 and j + 4 < 10:
			d1 = tuple([grid[i + x][j + x] for x in range(5)])
		if i - 4 >= 0 and j + 4 < 10:
			d2 = tuple([grid[i - x][j + x] for x in range(5)])
		s.add(r)
		s.add(d)
		s.add(d1)
		s.add(d2)
if len(s2 & s) > 0:
	print('YES')
else:
	print('NO')


import os
import sys
from io import BytesIO, IOBase
from collections import deque

def check(x, y):
	if x == 4 and y == 0:
		print('YES')
		exit(0)

def main():
	n = 10
	a = [input().rstrip() for _ in range(n)]
	for i in range(n):
		for j in range(n):
			if j + 4 < n:
				(c, d) = (0, 0)
				for k in range(5):
					if a[i][j + k] == 'X':
						c += 1
					elif a[i][j + k] == 'O':
						d += 1
				check(c, d)
			if i + 4 < n:
				(c, d) = (0, 0)
				for k in range(5):
					if a[i + k][j] == 'X':
						c += 1
					elif a[i + k][j] == 'O':
						d += 1
				check(c, d)
			if i + 4 < n and j + 4 < n:
				(c, d) = (0, 0)
				for k in range(5):
					if a[i + k][j + k] == 'X':
						c += 1
					elif a[i + k][j + k] == 'O':
						d += 1
				check(c, d)
			if i + 4 < n and j - 4 > -1:
				(c, d) = (0, 0)
				for k in range(5):
					if a[i + k][j - k] == 'X':
						c += 1
					elif a[i + k][j - k] == 'O':
						d += 1
				check(c, d)
	print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


matriz = [[letra for letra in input()] for i in range(10)]
flag = False
for i in range(10):
	for j in range(6):
		m = [matriz[i][j], matriz[i][j + 1], matriz[i][j + 2], matriz[i][j + 3], matriz[i][j + 4]]
		if m.count('.') == 1 and m.count('X') == 4:
			flag = True
			break
for i in range(6):
	for j in range(10):
		m = [matriz[i][j], matriz[i + 1][j], matriz[i + 2][j], matriz[i + 3][j], matriz[i + 4][j]]
		if m.count('.') == 1 and m.count('X') == 4:
			flag = True
			break
for i in range(6):
	for j in range(6):
		m = [matriz[i][j], matriz[i + 1][j + 1], matriz[i + 2][j + 2], matriz[i + 3][j + 3], matriz[i + 4][j + 4]]
		if m.count('.') == 1 and m.count('X') == 4:
			flag = True
			break
for i in range(6):
	for j in range(9, 3, -1):
		m = [matriz[i][j], matriz[i + 1][j - 1], matriz[i + 2][j - 2], matriz[i + 3][j - 3], matriz[i + 4][j - 4]]
		if m.count('.') == 1 and m.count('X') == 4:
			flag = True
			break
if flag:
	print('YES')
else:
	print('NO')


def din(matx):
	for i in range(10):
		for j in range(10):
			dd = False
			x = [[i, j], [i - 1, j - 1], [i - 2, j - 2], [i - 3, j - 3], [i - 4, j - 4]]
			for p in x:
				if p[0] > 9 or p[0] < 0 or p[1] > 9 or (p[1] < 0):
					dd = True
					break
			if not dd:
				c = 0
				for p in x:
					if matx[p[0]][p[1]] == 'X':
						c += 1
					if matx[p[0]][p[1]] == 'O':
						c = 0
						break
				if c == 4:
					return True
	return False

def dix(matx):
	for i in range(10):
		for j in range(10):
			dd = False
			x = [[i, j], [i + 1, j - 1], [i + 2, j - 2], [i + 3, j - 3], [i + 4, j - 4]]
			for p in x:
				if p[0] > 9 or p[0] < 0 or p[1] > 9 or (p[1] < 0):
					dd = True
					break
			if not dd:
				c = 0
				for p in x:
					if matx[p[0]][p[1]] == 'X':
						c += 1
					if matx[p[0]][p[1]] == 'O':
						c = 0
						break
				if c == 4:
					return True
	return False

def hoz(matx):
	for i in range(10):
		for j in range(10):
			dd = False
			x = [[i, j], [i, j - 1], [i, j - 2], [i, j - 3], [i, j - 4]]
			for p in x:
				if p[0] > 9 or p[0] < 0 or p[1] > 9 or (p[1] < 0):
					dd = True
					break
			if not dd:
				c = 0
				for p in x:
					if matx[p[0]][p[1]] == 'X':
						c += 1
					if matx[p[0]][p[1]] == 'O':
						c = 0
						break
				if c == 4:
					return True
	return False

def vet(matx):
	for i in range(10):
		for j in range(10):
			dd = False
			x = [[i, j], [i - 1, j], [i - 4, j], [i - 3, j], [i - 2, j]]
			for p in x:
				if p[0] > 9 or p[0] < 0 or p[1] > 9 or (p[1] < 0):
					dd = True
					break
			if not dd:
				c = 0
				for p in x:
					if matx[p[0]][p[1]] == 'X':
						c += 1
					if matx[p[0]][p[1]] == 'O':
						c = 0
						break
				if c == 4:
					return True
	return False
matx = [list(input().strip()) for i in range(10)]
if vet(matx) | hoz(matx) | din(matx) | dix(matx):
	print('YES')
else:
	print('NO')


def solve():
	grid = [list(get(str)) for i in range(10)]
	s2 = set(list(map(tuple, '.XXXX X.XXX XX.XX XXX.X XXXX.'.split())))
	for i in range(10):
		for j in range(10):
			s = set()
			(r, d, d1, d2) = (None, None, None, None)
			if j + 4 < 10:
				r = tuple([grid[i][j + x] for x in range(5)])
			if i + 4 < 10:
				d = tuple([grid[i + x][j] for x in range(5)])
			if i + 4 < 10 and j + 4 < 10:
				d1 = tuple([grid[i + x][j + x] for x in range(5)])
			if i - 4 >= 0 and j + 4 < 10:
				d2 = tuple([grid[i - x][j + x] for x in range(5)])
			s.add(r)
			s.add(d)
			s.add(d1)
			s.add(d2)
			if len(s2 & s) > 0:
				return 'YES'
	return 'NO'
_testcases = '\nXX.XX.....\n.....OOOO.\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n\nYES\n\nXXOXX.....\nOO.O......\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n\nNO\n\n....X.....\n...X......\n..........\n.X........\nX.........\n..........\n..........\n..........\n..........\n..........\n\nYES\n\nX.........\n.X........\n..X.......\n..........\n....X.....\n..........\n..........\n..........\n..........\n..........\n\nYES\n'.strip()
import re
import sys
import math
import heapq
from heapq import heapify, heappop, heappush
import bisect
from bisect import bisect_left, bisect_right
import operator
from operator import itemgetter, attrgetter
import itertools
import collections
inf = float('inf')
sys.setrecursionlimit(10000)

def tree():
	return collections.defaultdict(tree)

def cache(func):
	cache_dict = {}

	def _cached_func(*args, _get_cache=False):
		if _get_cache:
			return cache_dict
		if args in cache_dict:
			return cache_dict[args]
		cache_dict[args] = func(*args)
		return cache_dict[args]
	return _cached_func

def equal(x, y, epsilon=1e-06):
	if -epsilon <= x - y <= epsilon:
		return True
	if -epsilon <= x <= epsilon or -epsilon <= y <= epsilon:
		return False
	return -epsilon <= (x - y) / x <= epsilon or -epsilon <= (x - y) / y <= epsilon

def get(_type):
	if type(_type) == list:
		if len(_type) == 1:
			_type = _type[0]
			return list(map(_type, input().strip().split()))
		else:
			return [_type[i](inp) for (i, inp) in enumerate(input().strip().split())]
	else:
		return _type(input().strip())
print(solve())


def horizontal(mas):
	for i in range(len(mas) - 4):
		k = ''
		for j in range(i, i + 5):
			k += str(mas[j])
		if k == 'XXXX.':
			return True
		elif k == '.XXXX':
			return True
		elif k == 'X.XXX':
			return True
		elif k == 'XX.XX':
			return True
		elif k == 'XXX.X':
			return True
	return False
mas = []
flag = 0
for i in range(10):
	mas.append(list(input()))
for i in range(10):
	f = horizontal(mas[i])
	if f == True and flag == 0:
		flag = 1
		print('YES')
for i in range(10):
	ans = []
	for j in range(10):
		ans.append(mas[j][i])
	s = horizontal(ans)
	if s == True and flag == 0:
		flag = 1
		print('YES')
for i in range(10):
	for j in range(10):
		ans = []
		for o in range(10):
			if o + j == 10 or i + o == 10:
				break
			ans.append(mas[o + i][o + j])
		t = horizontal(ans)
		if t == True and flag == 0:
			flag = 1
			print('YES')
for i in range(10):
	for j in range(9, 0, -1):
		ans = []
		for o in range(10):
			if j - o < 0 or i + o == 10:
				break
			ans.append(mas[o + i][j - o])
		d = horizontal(ans)
		if d == True and flag == 0:
			flag = 1
			print('YES')
if flag == 0:
	print('NO')


matrix = list()
for _ in range(10):
	matrix.append(list(input()))
for i in range(10):
	for j in range(6):
		temp = matrix[i][j:j + 5]
		if temp.count('X') == 4 and '.' in temp:
			print('YES')
			quit()
for j in range(10):
	for i in range(6):
		temp = list()
		for k in range(i, i + 5):
			temp.append(matrix[k][j])
		if temp.count('X') == 4 and '.' in temp:
			print('YES')
			quit()
for i in range(6):
	for j in range(6):
		temp = list()
		for k in range(5):
			temp.append(matrix[i + k][j + k])
		if temp.count('X') == 4 and '.' in temp:
			print('YES')
			quit()
for i in range(0, 6):
	for j in range(4, 10):
		temp = list()
		for k in range(5):
			temp.append(matrix[i + k][j - k])
		if temp.count('X') == 4 and '.' in temp:
			print('YES')
			quit()
print('NO')


a = []
for i in range(10):
	a.append(input())

def valid(x, y):
	if 0 <= x <= 9 and 0 <= y <= 9:
		return True
	return False

def check(x, y, direction):
	ans = 1
	curr_x = x + direction[0]
	curr_y = y + direction[1]
	while valid(curr_x, curr_y) and a[curr_x][curr_y] == 'X':
		ans += 1
		curr_x += direction[0]
		curr_y += direction[1]
	curr_x = x - direction[0]
	curr_y = y - direction[1]
	while valid(curr_x, curr_y) and a[curr_x][curr_y] == 'X':
		ans += 1
		curr_x -= direction[0]
		curr_y -= direction[1]
	return ans
curr = 0
for i in range(10):
	for j in range(10):
		if a[i][j] == '.':
			for direction in [[1, 0], [0, 1], [1, 1], [1, -1]]:
				curr = max(curr, check(i, j, direction))
if curr >= 5:
	print('YES')
else:
	print('NO')


matrix = [None] * 10
for i in range(10):
	matrix[i] = input()
for i in range(10):
	for j in range(10):
		if 0 <= j and j <= 5:
			count_x = 0
			has_o = False
			for k in range(5):
				if matrix[i][j + k] == 'X':
					count_x += 1
				elif matrix[i][j + k] == 'O':
					has_o = True
					break
			if count_x == 4 and (not has_o):
				print('YES')
				exit()
			if 0 <= i and i <= 5:
				count_x = 0
				has_o = False
				for k in range(5):
					if matrix[i + k][j + k] == 'X':
						count_x += 1
					elif matrix[i + k][j + k] == 'O':
						has_o = True
						break
				if count_x == 4 and (not has_o):
					print('YES')
					exit()
		if 0 <= i and i <= 5:
			count_x = 0
			has_o = False
			for k in range(5):
				if matrix[i + k][j] == 'X':
					count_x += 1
				elif matrix[i + k][j] == 'O':
					has_o = True
					break
			if count_x == 4 and (not has_o):
				print('YES')
				exit()
			if 4 <= j and j <= 9:
				count_x = 0
				has_o = False
				for k in range(5):
					if matrix[i + k][j - k] == 'X':
						count_x += 1
					elif matrix[i + k][j - k] == 'O':
						has_o = True
						break
				if count_x == 4 and (not has_o):
					print('YES')
					exit()
print('NO')


def is_win(matrix):
	variants = ['.XXXX', 'X.XXX', 'XX.XX', 'XXX.X', 'XXXX.']
	for i in matrix:
		for exp in variants:
			if exp in ''.join(i):
				return True
	new_matrix = []
	for i in range(10):
		matrix_part = []
		for j in matrix:
			matrix_part.append(j[i])
		new_matrix.append(matrix_part)
	for i in new_matrix:
		for exp in variants:
			if exp in ''.join(i):
				return True
	lines = [[matrix[0][0], matrix[1][1], matrix[2][2], matrix[3][3], matrix[4][4], matrix[5][5], matrix[6][6], matrix[7][7], matrix[8][8], matrix[9][9]], [matrix[0][1], matrix[1][2], matrix[2][3], matrix[3][4], matrix[4][5], matrix[5][6], matrix[6][7], matrix[7][8], matrix[8][9]], [matrix[0][2], matrix[1][3], matrix[2][4], matrix[3][5], matrix[4][6], matrix[5][7], matrix[6][8], matrix[7][9]], [matrix[0][3], matrix[1][4], matrix[2][5], matrix[3][6], matrix[4][7], matrix[5][8], matrix[6][9]], [matrix[0][4], matrix[1][5], matrix[2][6], matrix[3][7], matrix[4][8], matrix[5][9]], [matrix[0][5], matrix[1][6], matrix[2][7], matrix[3][8], matrix[4][9]], [matrix[1][0], matrix[2][1], matrix[3][2], matrix[4][3], matrix[5][4], matrix[6][5], matrix[7][6], matrix[8][7], matrix[9][8]], [matrix[2][0], matrix[3][1], matrix[4][2], matrix[5][3], matrix[6][4], matrix[7][5], matrix[8][6], matrix[9][7]], [matrix[3][0], matrix[4][1], matrix[5][2], matrix[6][3], matrix[7][4], matrix[8][5], matrix[9][6]], [matrix[4][0], matrix[5][1], matrix[6][2], matrix[7][3], matrix[8][4], matrix[9][5]], [matrix[5][0], matrix[6][1], matrix[7][2], matrix[8][3], matrix[9][4]]]
	for line in lines:
		for exp in variants:
			if exp in ''.join(line):
				return True
	for i in range(10):
		matrix[i] = matrix[i][::-1]
	lines = [[matrix[0][0], matrix[1][1], matrix[2][2], matrix[3][3], matrix[4][4], matrix[5][5], matrix[6][6], matrix[7][7], matrix[8][8], matrix[9][9]], [matrix[0][1], matrix[1][2], matrix[2][3], matrix[3][4], matrix[4][5], matrix[5][6], matrix[6][7], matrix[7][8], matrix[8][9]], [matrix[0][2], matrix[1][3], matrix[2][4], matrix[3][5], matrix[4][6], matrix[5][7], matrix[6][8], matrix[7][9]], [matrix[0][3], matrix[1][4], matrix[2][5], matrix[3][6], matrix[4][7], matrix[5][8], matrix[6][9]], [matrix[0][4], matrix[1][5], matrix[2][6], matrix[3][7], matrix[4][8], matrix[5][9]], [matrix[0][5], matrix[1][6], matrix[2][7], matrix[3][8], matrix[4][9]], [matrix[1][0], matrix[2][1], matrix[3][2], matrix[4][3], matrix[5][4], matrix[6][5], matrix[7][6], matrix[8][7], matrix[9][8]], [matrix[2][0], matrix[3][1], matrix[4][2], matrix[5][3], matrix[6][4], matrix[7][5], matrix[8][6], matrix[9][7]], [matrix[3][0], matrix[4][1], matrix[5][2], matrix[6][3], matrix[7][4], matrix[8][5], matrix[9][6]], [matrix[4][0], matrix[5][1], matrix[6][2], matrix[7][3], matrix[8][4], matrix[9][5]], [matrix[5][0], matrix[6][1], matrix[7][2], matrix[8][3], matrix[9][4]]]
	for line in lines:
		for exp in variants:
			if exp in ''.join(line):
				return True
	return False
matrix = []
for i in range(10):
	matrix.append(input())
if is_win(matrix):
	print('YES')
else:
	print('NO')


def check(a, x, y):
	left = 0
	right = 0
	for i in range(1, 11):
		if x - i >= 0:
			if a[x - i][y] == 'X':
				left += 1
			else:
				break
		else:
			break
	for i in range(1, 11):
		if x + i < 10:
			if a[x + i][y] == 'X':
				right += 1
			else:
				break
		else:
			break
	if right + left >= 4:
		return 1
	left = 0
	right = 0
	for i in range(1, 11):
		if y - i >= 0:
			if a[x][y - i] == 'X':
				left += 1
			else:
				break
		else:
			break
	for i in range(1, 11):
		if y + i < 10:
			if a[x][y + i] == 'X':
				right += 1
			else:
				break
		else:
			break
	if right + left >= 4:
		return 1
	left = 0
	right = 0
	for i in range(1, 11):
		if x - i >= 0 and y - i >= 0:
			if a[x - i][y - i] == 'X':
				left += 1
			else:
				break
		else:
			break
	for i in range(1, 11):
		if x + i < 10 and y + i < 10:
			if a[x + i][y + i] == 'X':
				right += 1
			else:
				break
		else:
			break
	if right + left >= 4:
		return 1
	left = 0
	right = 0
	for i in range(1, 11):
		if x - i >= 0 and y + i < 10:
			if a[x - i][y + i] == 'X':
				left += 1
			else:
				break
		else:
			break
	for i in range(1, 11):
		if x + i < 10 and y - i >= 0:
			if a[x + i][y - i] == 'X':
				right += 1
			else:
				break
		else:
			break
	if right + left >= 4:
		return 1
	return 0
a = []
for i in range(10):
	gg = input()
	a.append([])
	for j in range(10):
		a[i].append(gg[j])
for i in range(10):
	for j in range(10):
		if a[i][j] == '.':
			a[i][j] = 'X'
			if check(a, i, j):
				print('YES')
				return
			a[i][j] = '.'
print('NO')


N = 10
A = []
for _ in range(N):
	A += [list(input())]
result = 'NO'
for i in range(N // 2 + 1):
	for j in range(N // 2 + 1):
		(cross, dots) = (0, 0)
		for k in range(N // 2):
			if A[i + k][j + k] == '.':
				dots += 1
			elif A[i + k][j + k] == 'X':
				cross += 1
		if cross == 4 and dots == 1:
			result = 'YES'
for i in range(N // 2 + 1):
	for j in range(N // 2 - 1, N):
		(cross, dots) = (0, 0)
		for k in range(N // 2):
			if A[i + k][j - k] == '.':
				dots += 1
			elif A[i + k][j - k] == 'X':
				cross += 1
		if cross == 4 and dots == 1:
			result = 'YES'
for i in range(N):
	for j in range(N // 2 + 1):
		(cross, dots) = (0, 0)
		for k in range(N // 2):
			if A[i][j + k] == '.':
				dots += 1
			elif A[i][j + k] == 'X':
				cross += 1
		if cross == 4 and dots == 1:
			result = 'YES'
for i in range(N // 2 + 1):
	for j in range(N):
		(cross, dots) = (0, 0)
		for k in range(N // 2):
			if A[i + k][j] == '.':
				dots += 1
			elif A[i + k][j] == 'X':
				cross += 1
		if cross == 4 and dots == 1:
			result = 'YES'
print(result)


from sys import exit

def is_in_row(field):
	for s in field:
		for i in range(len(s) - 4):
			if s[i:i + 5].count('X') == 4 and s[i:i + 5].count('.') == 1:
				print('YES')
				return True
	return False

def is_in_col(field):
	for s in map(lambda x: ''.join(x), zip(*field)):
		for i in range(len(s) - 4):
			if s[i:i + 5].count('X') == 4 and s[i:i + 5].count('.') == 1:
				print('YES')
				return True
	return False

def is_in_diag(field):
	shift = []
	for i in range(len(field)):
		shift.append(field[i][i:])
		shift[-1] += 'O' * (10 - len(shift[-1]))
	for s in map(lambda x: ''.join(x), zip(*shift)):
		for i in range(len(s) - 4):
			if s[i:i + 5].count('X') == 4 and s[i:i + 5].count('.') == 1:
				print('YES')
				return True
	shift = []
	for i in range(len(field)):
		shift.append(field[i][:i][::-1])
		shift[-1] += 'O' * (10 - len(shift[-1]))
	for s in map(lambda x: ''.join(x), zip(*shift)):
		for i in range(len(s) - 4):
			if s[i:i + 5].count('X') == 4 and s[i:i + 5].count('.') == 1:
				print('YES')
				return True
	return False
field = [input() for _ in range(10)]
if is_in_row(field):
	exit(0)
if is_in_col(field):
	exit(0)
if is_in_diag(field):
	exit(0)
if is_in_diag(list(map(lambda x: x[::-1], field))):
	exit(0)
print('NO')


import sys
a = [['.'] * 20 for _ in range(5)] + [list('.' * 5 + input() + '.' * 5) for _ in range(10)] + [['.'] * 20 for _ in range(5)]

def judge(y, x, dy, dx):
	return all((a[y + dy * d][x + dx * d] == 'X' for d in range(5)))

def solve(y, x):
	a[y][x] = 'X'
	for delta in range(-4, 5):
		if judge(y + delta, x, 1, 0) or judge(y, x + delta, 0, 1) or judge(y + delta, x + delta, 1, 1) or judge(y + delta, x - delta, 1, -1):
			return True
	a[y][x] = '.'
	return False
for i in range(5, 15):
	for j in range(5, 15):
		if a[i][j] == '.' and solve(i, j):
			print('YES')
			exit()
print('NO')


a = []
for i in range(10):
	a.append([])
	p = [c for c in input()]
	for j in range(10):
		if p[j] == 'X':
			a[i].append(1)
		elif p[j] == 'O':
			a[i].append(-1)
		elif p[j] == '.':
			a[i].append(0)
f = True
for i in range(10):
	for j in range(10):
		(s1, s2, s3, s4) = (0, 0, 0, 0)
		if i <= 5:
			s1 = a[i][j] + a[i + 1][j] + a[i + 2][j] + a[i + 3][j] + a[i + 4][j]
		if j <= 5:
			s2 = a[i][j] + a[i][j + 1] + a[i][j + 2] + a[i][j + 3] + a[i][j + 4]
		if i <= 5 and j <= 5:
			s3 = a[i][j] + a[i + 1][j + 1] + a[i + 2][j + 2] + a[i + 3][j + 3] + a[i + 4][j + 4]
		if i >= 4 and j <= 5:
			s4 = a[i][j] + a[i - 1][j + 1] + a[i - 2][j + 2] + a[i - 3][j + 3] + a[i - 4][j + 4]
		if max(s1, s2, s3, s4) == 4:
			f = False
if f:
	print('NO')
else:
	print('YES')


from copy import deepcopy
a = []
for _ in range(10):
	a.append(list(input()))
ans = False
for i in range(10):
	for j in range(10):
		if a[i][j] != '.':
			continue
		b = deepcopy(a)
		b[i][j] = 'X'
		for k in range(10):
			for l in range(6):
				if b[k][l] == b[k][l + 1] == b[k][l + 2] == b[k][l + 3] == b[k][l + 4] == 'X':
					ans = True
				if b[l][k] == b[l + 1][k] == b[l + 2][k] == b[l + 3][k] == b[l + 4][k] == 'X':
					ans = True
		for k in range(2, 8):
			for l in range(2, 8):
				if b[k - 2][l - 2] == b[k - 1][l - 1] == b[k][l] == b[k + 1][l + 1] == b[k + 2][l + 2] == 'X':
					ans = True
				if b[k - 2][l + 2] == b[k - 1][l + 1] == b[k][l] == b[k + 1][l - 1] == b[k + 2][l - 2] == 'X':
					ans = True
if ans:
	print('YES')
else:
	print('NO')


score = {'X': 1, 'O': -1, '.': 0}

def works(g, x, y):
	if x + 5 <= 10:
		cur = 0
		for d in range(5):
			cur += score[g[x + d][y]]
		if cur >= 4:
			return True
	if y + 5 <= 10:
		cur = sum((score[g[x][y + d]] for d in range(5)))
		if cur >= 4:
			return True
	if x + 5 <= 10 and y + 5 <= 10:
		cur = sum((score[g[x + d][y + d]] for d in range(5)))
		if cur >= 4:
			return True
	if x - 5 >= -1 and y + 5 <= 10:
		cur = sum((score[g[x - d][y + d]] for d in range(5)))
		if cur >= 4:
			return True
	return False
grid = []
for _ in range(10):
	grid.append(input())
o = False
for i in range(10):
	for j in range(10):
		if works(grid, i, j):
			o = True
print('YES' if o else 'NO')


def diagL(coor, arr):
	tmp = coor
	opt = 1
	while tmp - 11 >= 0 and tmp // 10 - 1 == (tmp - 11) // 10:
		tmp -= 11
		if arr[tmp] == 'X':
			opt += 1
		else:
			break
	tmp = coor
	while tmp + 11 < 100 and tmp // 10 + 1 == (tmp + 11) // 10:
		tmp += 11
		if arr[tmp] == 'X':
			opt += 1
		else:
			break
	if opt >= 5:
		return True
	return False

def diagR(coor, arr):
	tmp = coor
	opt = 1
	while tmp - 9 >= 0 and tmp // 10 - 1 == (tmp - 9) // 10:
		tmp -= 9
		if arr[tmp] == 'X':
			opt += 1
		else:
			break
	tmp = coor
	while tmp + 9 < 100 and tmp // 10 + 1 == (tmp + 9) // 10:
		tmp += 9
		if arr[tmp] == 'X':
			opt += 1
		else:
			break
	if opt >= 5:
		return True
	return False

def sideX(coor, arr):
	tmp = coor
	opt = 1
	while (tmp - 1) // 10 == coor // 10:
		tmp -= 1
		if arr[tmp] == 'X':
			opt += 1
		else:
			break
	tmp = coor
	while (tmp + 1) // 10 == coor // 10:
		tmp += 1
		if arr[tmp] == 'X':
			opt += 1
		else:
			break
	if opt >= 5:
		return True
	return False

def sideY(coor, arr):
	tmp = coor
	opt = 1
	while tmp - 10 >= 0:
		tmp -= 10
		if arr[tmp] == 'X':
			opt += 1
		else:
			break
	tmp = coor
	while tmp + 10 < 100:
		tmp += 10
		if arr[tmp] == 'X':
			opt += 1
		else:
			break
	if opt >= 5:
		return True
	return False
ans = []
for i in range(10):
	a = list(input())
	for k in range(10):
		ans.append(a[k])
a = []
for i in range(100):
	if ans[i] == '.':
		a.append(diagL(i, ans))
		a.append(diagR(i, ans))
		a.append(sideX(i, ans))
		a.append(sideY(i, ans))
if any(a):
	print('YES')
else:
	print('NO')


def find(r, c, s1, s2):
	combo = 0
	while a[r][c] == 'X':
		r += s1
		c += s2
		combo += 1
	return combo
a = ['@@@@@@@@@@@@']
marks = []
dots = []
ans = 1
for i in range(10):
	a.append('@' + input() + '@')
a.append('@@@@@@@@@@@@')
for i in range(1, 11):
	for j in range(1, 11):
		if a[i][j] == '.':
			res1 = find(i, j - 1, 0, -1) + find(i, j + 1, 0, 1)
			res2 = find(i + 1, j, 1, 0) + find(i - 1, j, -1, 0)
			res3 = find(i + 1, j + 1, 1, 1) + find(i - 1, j - 1, -1, -1)
			res4 = find(i + 1, j - 1, 1, -1) + find(i - 1, j + 1, -1, 1)
			if res1 > 3 or res2 > 3 or res3 > 3 or (res4 > 3):
				ans = 0
print('YNEOS'[ans::2])


import itertools

def main():
	global MAP
	MAP = []
	for i in range(10):
		MAP.append(list(input()))
	for (i, j) in itertools.product(range(10), range(10)):
		if check(i, j):
			print('YES')
			return
	print('NO')

def check(i, j):
	for (a, b) in [(0, 1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, 0), (0, -1), (-1, -1)]:
		count = 0
		ecount = 0
		for k in range(5):
			if not 0 <= i + k * a <= 9 or not 0 <= j + k * b <= 9:
				break
			if MAP[i + k * a][j + k * b] == 'X':
				count += 1
			elif MAP[i + k * a][j + k * b] == '.':
				ecount += 1
		if count == 4 and ecount == 1:
			return True
	return False
main()


from sys import stdin

def myInput():
	board = [[], [], [[] for _ in range(20)], [[] for _ in range(20)]]
	for line in stdin:
		board[0].append(list(line.rstrip()))
	board[1] = map(list, zip(*board[0]))
	for i in range(len(board[0])):
		for j in range(len(board[0])):
			board[2][i + j].append(board[0][i][j])
			board[3][i - j + len(board[0])].append(board[0][i][j])
	return board

def solve(board):
	for b in board:
		for line in b:
			val_bef = 0
			val_eft = 0
			ok = False
			for dig in line:
				if dig == 'O':
					ok = False
					val_bef = 0
					val_eft = 0
				else:
					if dig == 'X':
						if ok:
							val_eft += 1
						else:
							val_bef += 1
					elif dig == '.':
						if ok:
							ok = True
							val_bef = val_eft
							val_eft = 0
						else:
							ok = True
					if ok and val_eft + val_bef >= 4:
						return True
	return False
board = myInput()
if solve(board):
	print('YES')
else:
	print('NO')


def is_in_row(field):
	for s in field:
		for i in range(len(s) - 4):
			if s[i:i + 5].count('X') == 4 and s[i:i + 5].count('.') == 1:
				print('YES')
				return True
	return False

def is_in_col(field):
	for s in [''.join(x) for x in zip(*field)]:
		for i in range(len(s) - 4):
			if s[i:i + 5].count('X') == 4 and s[i:i + 5].count('.') == 1:
				print('YES')
				return True
	return False

def is_in_diag(field):
	shift = []
	for i in range(len(field)):
		shift.append(field[i][i:])
		shift[-1] += 'O' * (10 - len(shift[-1]))
	for s in [''.join(x) for x in zip(*shift)]:
		for i in range(len(s) - 4):
			if s[i:i + 5].count('X') == 4 and s[i:i + 5].count('.') == 1:
				print('YES')
				return True
	shift = []
	for i in range(len(field)):
		shift.append(field[i][:i][::-1])
		shift[-1] += 'O' * (10 - len(shift[-1]))
	for s in [''.join(x) for x in zip(*shift)]:
		for i in range(len(s) - 4):
			if s[i:i + 5].count('X') == 4 and s[i:i + 5].count('.') == 1:
				print('YES')
				return True
	return False
field = [input() for _ in range(10)]
if is_in_row(field):
	return
if is_in_col(field):
	return
if is_in_diag(field):
	return
if is_in_diag(list([x[::-1] for x in field])):
	return
print('NO')


arr = list()
for _ in range(10):
	arr.append(list(input()))
for i in range(10):
	for j in range(6):
		lst = arr[i][j:j + 5]
		if lst.count('X') == 4 and '.' in lst:
			print('YES')
			exit()
for j in range(10):
	for i in range(6):
		lst = list()
		for k in range(i, i + 5):
			lst.append(arr[k][j])
			if lst.count('X') == 4 and '.' in lst:
				print('YES')
				exit()
for i in range(6):
	for j in range(6):
		lst = list()
		for k in range(5):
			lst.append(arr[i + k][j + k])
			if lst.count('X') == 4 and '.' in lst:
				print('YES')
				exit()
for i in range(6):
	for j in range(4, 10):
		lst = list()
		for k in range(5):
			lst.append(arr[i + k][j - k])
		if lst.count('X') == 4 and '.' in lst:
			print('YES')
			exit()
print('NO')


corr = lambda i, j: 0 <= i < 10 and 0 <= j < 10

def can(b):
	for i in range(10):
		for j in range(10):
			for t in range(4):
				flag = 1
				for k in range(5):
					ni = i + dx[t] * k
					nj = j + dy[t] * k
					if not corr(ni, nj) or b[ni][nj] != 'X':
						flag = 0
						break
				if flag:
					return 1
	return 0

def solve():
	b = [list(i) for i in a]
	for i in range(10):
		for j in range(10):
			if b[i][j] == '.':
				temp = b[i][j]
				b[i][j] = 'X'
				if can(b):
					return 1
				b[i][j] = temp
	return 0
(dx, dy) = ([0, 1, 1, -1], [1, 0, 1, 1])
a = [input() for i in range(10)]
print('YES' if solve() else 'NO')


mat = []
n = 10
m = 10
for i in range(n):
	s = input()
	s = list(s)
	mat.append(s)
f = 0

def check(mat):
	for i in range(10):
		for j in range(10):
			for k in range(5):
				if i + k >= 10 or mat[i + k][j] != 'X':
					break
			else:
				return 1
			for k in range(5):
				if j + k >= 10 or mat[i][j + k] != 'X':
					break
			else:
				return 1
			for k in range(5):
				if i + k >= 10 or j + k >= 10 or mat[i + k][j + k] != 'X':
					break
			else:
				return 1
			for k in range(5):
				if i + k >= 10 or j - k < 0 or mat[i + k][j - k] != 'X':
					break
			else:
				return 1
	return 0
for i in range(n):
	for j in range(m):
		if mat[i][j] == '.':
			mat[i][j] = 'X'
			if check(mat):
				f = 1
				print('YES')
				exit()
			else:
				mat[i][j] = '.'
print('NO')


import os

def f():
	board = []
	for i in range(10):
		board.append(input())
	for (i, row) in enumerate(board):
		for (j, c) in enumerate(row):
			if c == '.':
				d1 = d2 = 0
				b = j - 1
				while b >= 0:
					if row[b] == 'X':
						d1 += 1
						b -= 1
					else:
						break
				b = j + 1
				while b <= 9:
					if row[b] == 'X':
						d2 += 1
						b += 1
					else:
						break
				if d1 + d2 >= 4:
					print('YES')
					return
				d1 = d2 = 0
				a = i - 1
				while a >= 0:
					if board[a][j] == 'X':
						d1 += 1
						a -= 1
					else:
						break
				a = i + 1
				while a <= 9:
					if board[a][j] == 'X':
						d2 += 1
						a += 1
					else:
						break
				if d1 + d2 >= 4:
					print('YES')
					return
				d1 = d2 = 0
				a = i - 1
				b = j - 1
				while a >= 0 and b >= 0:
					if board[a][b] == 'X':
						d1 += 1
						a -= 1
						b -= 1
					else:
						break
				a = i + 1
				b = j + 1
				while a <= 9 and b <= 9:
					if board[a][b] == 'X':
						d2 += 1
						a += 1
						b += 1
					else:
						break
				if d1 + d2 >= 4:
					print('YES')
					return
				d1 = d2 = 0
				a = i + 1
				b = j - 1
				while a <= 9 and b >= 0:
					if board[a][b] == 'X':
						d1 += 1
						a += 1
						b -= 1
					else:
						break
				a = i - 1
				b = j + 1
				while a >= 0 and b <= 9:
					if board[a][b] == 'X':
						d2 += 1
						a -= 1
						b += 1
					else:
						break
				if d1 + d2 >= 4:
					print('YES')
					return
	print('NO')
f()


def check(a, b, c, d, e):
	countX = 0
	countD = 0
	if a == 'X':
		countX += 1
	elif a == '.':
		countD += 1
	if b == 'X':
		countX += 1
	elif b == '.':
		countD += 1
	if c == 'X':
		countX += 1
	elif c == '.':
		countD += 1
	if d == 'X':
		countX += 1
	elif d == '.':
		countD += 1
	if e == 'X':
		countX += 1
	elif e == '.':
		countD += 1
	return countX == 4 and countD == 1

def f(a):
	for i in range(10):
		for j in range(6):
			if check(a[i][j], a[i][j + 1], a[i][j + 2], a[i][j + 3], a[i][j + 4]) or (i < 6 and check(a[i][j], a[i + 1][j + 1], a[i + 2][j + 2], a[i + 3][j + 3], a[i + 4][j + 4])):
				return True
	for i in range(10):
		for j in range(6):
			if check(a[j][i], a[j + 1][i], a[j + 2][i], a[j + 3][i], a[j + 4][i]) or (i > 3 and check(a[j][i], a[j + 1][i - 1], a[j + 2][i - 2], a[j + 3][i - 3], a[j + 4][i - 4])):
				return True
print('YES' if f([input() for _ in range(10)]) else 'NO')


matrix = []
N = 10
for i in range(N):
	matrix.append(list(input()))
won = False

def check_alice_won(matrix):
	maxScore = 0
	for i in range(N):
		curScore = 0
		for j in range(N):
			if matrix[i][j] == 'X':
				curScore += 1
			else:
				if curScore > maxScore:
					maxScore = curScore
				curScore = 0
		if curScore >= maxScore:
			maxScore = curScore
		if maxScore >= 5:
			return True
	maxScore = 0
	for i in range(N):
		curScore = 0
		for j in range(N):
			if matrix[j][i] == 'X':
				curScore += 1
			else:
				if curScore > maxScore:
					maxScore = curScore
				curScore = 0
		if curScore >= maxScore:
			maxScore = curScore
		if maxScore >= 5:
			return True
	maxScore = 0
	for p in range(0, 2 * N - 1):
		curScore = 0
		for q in list(range(max(0, p - N + 1), min(p, N - 1) + 1)):
			if matrix[p - q][q] == 'X':
				curScore += 1
			else:
				if curScore > maxScore:
					maxScore = curScore
				curScore = 0
		if curScore >= maxScore:
			maxScore = curScore
		if maxScore >= 5:
			return True
	maxScore = 0
	for p in range(0, 2 * N - 1):
		curScore = 0
		for q in list(range(max(0, p - N + 1), min(p, N - 1) + 1)):
			if matrix[p - q][N - 1 - q] == 'X':
				curScore += 1
			else:
				if curScore >= maxScore:
					maxScore = curScore
				curScore = 0
		if curScore >= maxScore:
			maxScore = curScore
		if maxScore >= 5:
			return True
	return False
for i in range(N):
	for j in range(N):
		if matrix[i][j] == '.' and won == False:
			matrix[i][j] = 'X'
			if check_alice_won(matrix) == True:
				won = True
			matrix[i][j] = '.'
if won:
	print('YES')
else:
	print('NO')


r = [input() for _ in range(10)]
c = []
for i in range(10):
	t = ''
	for j in range(10):
		t += r[j][i]
	c.append(t)
for x in r:
	if any((s in x for s in ['.XXXX', 'X.XXX', 'XX.XX', 'XXX.X', 'XXXX.'])):
		print('YES')
		quit()
else:
	for y in c:
		if any((s in y for s in ['.XXXX', 'X.XXX', 'XX.XX', 'XXX.X', 'XXXX.'])):
			print('YES')
			quit()
	else:
		for a in range(6):
			z1 = ''
			z2 = ''
			for b in range(10 - a):
				z1 += r[a + b][b]
				z2 += r[b][a + b]
			if any((s in z1 for s in ['.XXXX', 'X.XXX', 'XX.XX', 'XXX.X', 'XXXX.'])):
				print('YES')
				quit()
			if any((s in z2 for s in ['.XXXX', 'X.XXX', 'XX.XX', 'XXX.X', 'XXXX.'])):
				print('YES')
				quit()
		c = list(zip(*r[::-1]))
		for a in range(6):
			z1 = ''
			z2 = ''
			for b in range(10 - a):
				z1 += c[a + b][b]
				z2 += c[b][a + b]
			if any((s in z1 for s in ['.XXXX', 'X.XXX', 'XX.XX', 'XXX.X', 'XXXX.'])):
				print('YES')
				quit()
			if any((s in z2 for s in ['.XXXX', 'X.XXX', 'XX.XX', 'XXX.X', 'XXXX.'])):
				print('YES')
				quit()
	print('NO')


def check(i, j):
	i1 = i
	j1 = j
	i2 = i
	j2 = j
	while j1 + 1 <= m - 1 and mat[i][j1 + 1] == 'X':
		j1 += 1
	while j2 - 1 >= 0 and mat[i][j2 - 1] == 'X':
		j2 -= 1
	if abs(j2 - j1) >= 4:
		return True
	i1 = i
	j1 = j
	i2 = i
	j2 = j
	while i1 + 1 <= n - 1 and mat[i1 + 1][j] == 'X':
		i1 += 1
	while i2 - 1 >= 0 and mat[i2 - 1][j] == 'X':
		i2 -= 1
	if abs(i1 - i2) >= 4:
		return True
	i1 = i
	j1 = j
	i2 = i
	j2 = j
	while i1 - 1 >= 0 and j1 + 1 <= m - 1 and (mat[i1 - 1][j1 + 1] == 'X'):
		i1 -= 1
		j1 += 1
	while i2 + 1 <= n - 1 and j2 - 1 >= 0 and (mat[i2 + 1][j2 - 1] == 'X'):
		i2 += 1
		j2 -= 1
	if abs(i1 - i2) >= 4 and abs(j1 - j2) >= 4:
		return True
	i1 = i
	j1 = j
	i2 = i
	j2 = j
	while i1 - 1 >= 0 and j1 - 1 >= 0 and (mat[i1 - 1][j1 - 1] == 'X'):
		i1 -= 1
		j1 -= 1
	while i2 + 1 <= n - 1 and j2 + 1 <= m - 1 and (mat[i2 + 1][j2 + 1] == 'X'):
		i2 += 1
		j2 += 1
	if abs(i1 - i2) >= 4 and abs(j1 - j2) >= 4:
		return True
	return False
(n, m) = (10, 10)
mat = [list(input()) for _ in range(m)]
for i in range(n):
	for j in range(m):
		if mat[i][j] == '.':
			mat[i][j] = 'X'
			if check(i, j):
				print('YES')
				exit(0)
			mat[i][j] = '.'
print('NO')


m = []
for i in range(10):
	s = input()
	m.append(s)
for i in range(10):
	for j in range(6):
		s = ''
		s += m[i][j] + m[i][j + 1] + m[i][j + 2] + m[i][j + 3] + m[i][j + 4]
		if s.count('X') == 4 and s.count('O') == 0:
			print('YES')
			exit()
for i in range(10):
	for j in range(6):
		s = ''
		s += m[j][i] + m[j + 1][i] + m[j + 2][i] + m[j + 3][i] + m[j + 4][i]
		if s.count('X') == 4 and s.count('O') == 0:
			print('YES')
			exit()
for i in range(6):
	for j in range(6):
		s = ''
		s += m[j][i] + m[j + 1][i + 1] + m[j + 2][i + 2] + m[j + 3][i + 3] + m[j + 4][i + 4]
		if s.count('X') == 4 and s.count('O') == 0:
			print('YES')
			exit()
for i in range(6):
	for j in range(6):
		s = ''
		s += m[j + 4][i] + m[j + 3][i + 1] + m[j + 2][i + 2] + m[j + 1][i + 3] + m[j][i + 4]
		if s.count('X') == 4 and s.count('O') == 0:
			print('YES')
			exit()
print('NO')


def get_rows(grid):
	return [[c for c in r] for r in grid]

def get_cols(grid):
	return zip(*grid)

def get_backward_diagonals(grid):
	b = [None] * (len(grid) - 1)
	grid = [b[i:] + r + b[:i] for (i, r) in enumerate(get_rows(grid))]
	return [[c for c in r if c is not None] for r in get_cols(grid)]

def get_forward_diagonals(grid):
	b = [None] * (len(grid) - 1)
	grid = [b[:i] + r + b[i:] for (i, r) in enumerate(get_rows(grid))]
	return [[c for c in r if c is not None] for r in get_cols(grid)]

def won(s):
	for row in s:
		for i in range(len(row) - 4):
			substr = row[i:i + 5]
			if substr.count('X') == 4 and substr.count('.') == 1:
				return True
	t = [[s[j][i] for j in range(10)] for i in range(10)]
	for row in t:
		for i in range(len(row) - 4):
			substr = row[i:i + 5]
			if substr.count('X') == 4 and substr.count('.') == 1:
				return True
	for diag in get_backward_diagonals(s):
		for i in range(len(diag) - 4):
			substr = diag[i:i + 5]
			if substr.count('X') == 4 and substr.count('.') == 1:
				return True
	for diag in get_forward_diagonals(s):
		for i in range(len(diag) - 4):
			substr = diag[i:i + 5]
			if substr.count('X') == 4 and substr.count('.') == 1:
				return True
s = [list(input()) for _ in range(10)]
if won(s):
	print('YES')
else:
	print('NO')


def checkhor(x, y):
	c = 0
	cy = y + 1
	while cy < n and grid[x][cy] == 'X':
		cy += 1
		c += 1
	if c >= 4:
		return True
	cy = y - 1
	while cy >= 0 and grid[x][cy] == 'X':
		cy -= 1
		c += 1
	if c >= 4:
		return True
	else:
		return False

def checkver(x, y):
	c = 0
	cx = x + 1
	while cx < n and grid[cx][y] == 'X':
		cx += 1
		c += 1
	if c >= 4:
		return True
	cx = x - 1
	while cx >= 0 and grid[cx][y] == 'X':
		cx -= 1
		c += 1
	if c >= 4:
		return True
	else:
		return False

def checkdiag(x, y):
	c = 0
	cx = x + 1
	cy = y + 1
	while cx < n and cy < n and (grid[cx][cy] == 'X'):
		cx += 1
		cy += 1
		c += 1
	if c >= 4:
		return True
	cx = x - 1
	cy = y - 1
	while cx >= 0 and cy >= 0 and (grid[cx][cy] == 'X'):
		cx -= 1
		cy -= 1
		c += 1
	if c >= 4:
		return True
	c = 0
	cx = x + 1
	cy = y - 1
	while cx < n and cy >= 0 and (grid[cx][cy] == 'X'):
		cx += 1
		cy -= 1
		c += 1
	if c >= 4:
		return True
	cx = x - 1
	cy = y + 1
	while cx >= 0 and cy < n and (grid[cx][cy] == 'X'):
		cx -= 1
		cy += 1
		c += 1
	if c >= 4:
		return True
	else:
		return False
n = 10
grid = []
for i in range(n):
	grid.append(list(input()))
ans = 'NO'
for i in range(n):
	for j in range(n):
		if grid[i][j] == '.':
			if checkhor(i, j) or checkver(i, j) or checkdiag(i, j):
				ans = 'YES'
				break
	if ans == 'YES':
		break
print(ans)


mat = []
for i in range(10):
	li = list(input())
	mat.append(li)
d = [(1, 0), (0, 1), (1, 1), (1, -1)]
for i in range(10):
	for j in range(10):
		for (dx, dy) in d:
			c = 0
			t = 0
			for k in range(5):
				row = i + dx * k
				col = j + dy * k
				if row < 10 and row >= 0 and (col < 10) and (col >= 0):
					if mat[row][col] == 'X':
						c += 1
					elif mat[row][col] == '.':
						t += 1
			if c == 4 and t == 1:
				print('YES')
				exit()
print('NO')


import sys
input = sys.stdin.readline
s = [list(map(lambda x: 1 if x == 'X' else 2 if x == 'O' else 0, input().rstrip())) for _ in range(10)]

def check(sx, sy):
	return all((x < 10 and s[sy][x] == 1 for x in range(sx, sx + 5))) or all((y < 10 and s[y][sx] == 1 for y in range(sy, sy + 5))) or all((x < 10 and y < 10 and (s[y][x] == 1) for (x, y) in zip(range(sx, sx + 5), range(sy, sy + 5)))) or all((x < 10 and 0 <= y and (s[y][x] == 1) for (x, y) in zip(range(sx, sx + 5), range(sy, sy - 5, -1))))
for y in range(10):
	for x in range(10):
		if s[y][x] != 0:
			continue
		s[y][x] = 1
		if any((check(i, j) for i in range(10) for j in range(10))):
			print('YES')
			exit()
		s[y][x] = 0
print('NO')


import sys

def check(x):
	(t, p) = (0, 0)
	for i in range(5):
		if x[i] == 'X':
			t += 1
		elif x[i] == '.':
			p += 1
	if t == 4 and p == 1:
		return True
	return False

def main():
	x = []
	for i in range(10):
		x.append(sys.stdin.readline().rstrip())
	flag = False
	for i in range(10):
		for j in range(10):
			if j + 4 < 10 and check([x[i][k] for k in range(j, j + 5)]):
				flag = True
			if i + 4 < 10 and check([x[k][j] for k in range(i, i + 5)]):
				flag = True
			if i + 4 < 10 and j + 4 < 10 and check([x[i + k][j + k] for k in range(5)]):
				flag = True
			if i + 4 < 10 and j - 4 >= 0 and check([x[i + k][j - k] for k in range(5)]):
				flag = True
	if flag:
		print('YES')
	else:
		print('NO')
main()


import sys
from bisect import bisect_left as lb
from collections import deque
from queue import PriorityQueue as pq
from math import *
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
inv = lambda x: pow(x, mod - 2, mod)
mod = 10 ** 9 + 7
mat = []
for i in range(10):
	mat.append(list(ip()))

def check(a):
	if a.count('X') == 4 and a.count('.') == 1:
		print('YES')
		exit(0)
for i in range(10):
	for j in range(6):
		check([mat[i][j], mat[i][j + 1], mat[i][j + 2], mat[i][j + 3], mat[i][j + 4]])
		check([mat[j][i], mat[j + 1][i], mat[j + 2][i], mat[j + 3][i], mat[j + 4][i]])
for i in range(6):
	for j in range(6):
		check([mat[i][j], mat[i + 1][j + 1], mat[i + 2][j + 2], mat[i + 3][j + 3], mat[i + 4][j + 4]])
		check([mat[i + 4][j], mat[i + 3][j + 1], mat[i + 2][j + 2], mat[i + 1][j + 3], mat[i][j + 4]])
print('NO')