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

import java.util.*;
import java.lang.*;
import java.io.*;

public class feb20 {

	// __/\\\\\\\\\\\\\______/\\\\\\\\\_________/\\\\\\\\\___________/\\\\\\\\\__/\\\\\\\\\\\\\\\__/\\\\\\\\\\\________/\\\\\\\\\__/\\\\\\\\\\\\\\\_
	// _\/\\\/////////\\\__/\\\///////\\\_____/\\\\\\\\\\\\\______/\\\////////__\///////\\\/////__\/////\\\///______/\\\////////__\/\\\///////////__
	// _\/\\\_______\/\\\_\/\\\_____\/\\\____/\\\/////////\\\___/\\\/_________________\/\\\___________\/\\\_______/\\\/___________\/\\\_____________
	// _\/\\\\\\\\\\\\\/__\/\\\\\\\\\\\/____\/\\\_______\/\\\__/\\\___________________\/\\\___________\/\\\______/\\\_____________\/\\\\\\\\\\\_____
	// _\/\\\/////////____\/\\\//////\\\____\/\\\\\\\\\\\\\\\_\/\\\___________________\/\\\___________\/\\\_____\/\\\_____________\/\\\///////______
	// _\/\\\_____________\/\\\____\//\\\___\/\\\/////////\\\_\//\\\__________________\/\\\___________\/\\\_____\//\\\____________\/\\\_____________
	// _\/\\\_____________\/\\\_____\//\\\__\/\\\_______\/\\\__\///\\\________________\/\\\___________\/\\\______\///\\\__________\/\\\_____________
	// _\/\\\_____________\/\\\______\//\\\_\/\\\_______\/\\\____\////\\\\\\\\\_______\/\\\________/\\\\\\\\\\\____\////\\\\\\\\\_\/\\\\\\\\\\\\\\\_
	// _\///______________\///________\///__\///________\///________\/////////________\///________\///////////________\/////////__\///////////////__

	// created by : Nitesh Gupta

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int n = 10;
		int[][] arr = new int[n][n];
		for (int i = 0; i < n; i++) {
			String[] scn = (br.readLine()).trim().split("");
			for (int j = 0; j < n; j++) {
				if (scn[j].charAt(0) == 'X') {
					arr[i][j] = 1;
				}
				if (scn[j].charAt(0) == 'O') {
					arr[i][j] = 2;
				}
			}
		}
		boolean pos = false;

		// check horizontal
		for (int i = 0; i < n; i++) {
			int alice = 0, empty = 0;
			int start = 0;
			for (int j = 0; j < 4; j++) {
				if (arr[i][j] == 1)
					alice += 1;
				if (arr[i][j] == 0)
					empty += 1;
			}
			for (int j = 4; j < n; j++) {
				if (arr[i][j] == 1)
					alice += 1;
				if (arr[i][j] == 0)
					empty += 1;

				if (empty == 1 && alice == 4) {
					pos = true;
				} else {
					if (arr[i][start] == 1)
						alice -= 1;
					if (arr[i][start] == 0)
						empty -= 1;
					start += 1;
				}
			}

		}

		// check vertical
		for (int j = 0; j < n; j++) {
			int alice = 0, empty = 0;
			int start = 0;
			for (int i = 0; i < 4; i++) {
				if (arr[i][j] == 1)
					alice += 1;
				if (arr[i][j] == 0)
					empty += 1;
			}
			for (int i = 4; i < n; i++) {
				if (arr[i][j] == 1)
					alice += 1;
				if (arr[i][j] == 0)
					empty += 1;

				if (empty == 1 && alice == 4) {
					pos = true;
				} else {
					if (arr[start][j] == 1)
						alice -= 1;
					if (arr[start][j] == 0)
						empty -= 1;
					start += 1;
				}
			}

		}
// main diagonal part 1
		int r = 0, c = 0;
		while (r < 10) {
			int i = r;
			int j = c;
			int alice = 0;
			int empty = 0;
			int si = r, sj = c;
			int count = 0;
			while (i < n && j < n) {
				if (arr[i][j] == 1)
					alice += 1;
				if (arr[i][j] == 0)
					empty += 1;
				i += 1;
				j += 1;

				count += 1;
				if (count == 4) {
					break;
				}
			}
			if (count == 4) {
				while (i < n && j < n) {
					if (arr[i][j] == 1)
						alice += 1;
					if (arr[i][j] == 0)
						empty += 1;
					i += 1;
					j += 1;
					if (empty == 1 && alice == 4) {
						pos = true;
					} else {
						if (arr[si][sj] == 1)
							alice -= 1;
						if (arr[si][sj] == 0)
							empty -= 1;
						si += 1;
						sj += 1;
					}
				}

			}

			r += 1;
		}
//		main diagonal part 2
		r = 0;
		c = 0;
		while (c < 10) {
			int i = r;
			int j = c;
			int alice = 0;
			int empty = 0;
			int si = r, sj = c;
			int count = 0;
			while (i < n && j < n) {
				if (arr[i][j] == 1)
					alice += 1;
				if (arr[i][j] == 0)
					empty += 1;
				i += 1;
				j += 1;

				count += 1;
				if (count == 4) {
					break;
				}
			}
			if (count == 4) {
				while (i < n && j < n) {
					if (arr[i][j] == 1)
						alice += 1;
					if (arr[i][j] == 0)
						empty += 1;
					i += 1;
					j += 1;
					if (empty == 1 && alice == 4) {
						pos = true;
					} else {
						if (arr[si][sj] == 1)
							alice -= 1;
						if (arr[si][sj] == 0)
							empty -= 1;
						si += 1;
						sj += 1;
					}
				}

			}

			c += 1;
		}

//		another diagonal part 1

		r = 0;
		c = n - 1;
		while (c >= 0) {
			int i = r;
			int j = c;
			int alice = 0;
			int empty = 0;
			int si = r, sj = c;
			int count = 0;
			while (i < n && j >= 0) {
				if (arr[i][j] == 1)
					alice += 1;
				if (arr[i][j] == 0)
					empty += 1;
				i += 1;
				j -= 1;

				count += 1;
				if (count == 4) {
					break;
				}
			}
			if (count == 4) {
				while (i < n && j >= 0) {
					if (arr[i][j] == 1)
						alice += 1;
					if (arr[i][j] == 0)
						empty += 1;
					i += 1;
					j -= 1;
					if (empty == 1 && alice == 4) {
						pos = true;
					} else {
						if (arr[si][sj] == 1)
							alice -= 1;
						if (arr[si][sj] == 0)
							empty -= 1;
						si += 1;
						sj -= 1;
					}
				}

			}

			c -= 1;
		}
//		another diagonal part 2

		r = 0;
		c = n - 1;
		while (r < n) {
			int i = r;
			int j = c;
			int alice = 0;
			int empty = 0;
			int si = r, sj = c;
			int count = 0;
			while (i < n && j >= 0) {
				if (arr[i][j] == 1)
					alice += 1;
				if (arr[i][j] == 0)
					empty += 1;
				i += 1;
				j -= 1;

				count += 1;
				if (count == 4) {
					break;
				}
			}
			if (count == 4) {
				while (i < n && j >= 0) {
					if (arr[i][j] == 1)
						alice += 1;
					if (arr[i][j] == 0)
						empty += 1;
					i += 1;
					j -= 1;
					if (empty == 1 && alice == 4) {
						pos = true;
					} else {
						if (arr[si][sj] == 1)
							alice -= 1;
						if (arr[si][sj] == 0)
							empty -= 1;
						si += 1;
						sj -= 1;
					}
				}

			}

			r += 1;
		}

		System.out.println(pos ? "YES" : "NO");
		return;

	}

	public static void sec() throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		StringBuilder sb = new StringBuilder();
		while (t-- > 0) {
			String[] scn = (br.readLine()).trim().split(" ");
			int n = Integer.parseInt(scn[0]);
			long[] arr = new long[n];
			scn = (br.readLine()).trim().split(" ");
			for (int i = 0; i < n; i++) {
				arr[i] = Long.parseLong(scn[i]);
			}
			sb.append("\n");
		}
		System.out.println(sb);
		return;

	}

	private static void third() throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String[] scn = (br.readLine()).trim().split(" ");
		int n = Integer.parseInt(scn[0]);
		long[] arr = new long[n];
		scn = (br.readLine()).trim().split(" ");
		for (int i = 0; i < n; i++) {
			arr[i] = Long.parseLong(scn[i]);
		}
		System.out.println(sb);
		return;

	}

	public static void sort(long[] arr) {
		int n = arr.length;
		for (int i = 0; i < n; i++) {
			int idx = (int) Math.random() * n;
			long temp = arr[i];
			arr[i] = arr[idx];
			arr[idx] = temp;
		}

		Arrays.sort(arr);
	}

	public static void sort(int[] arr) {
		int n = arr.length;
		for (int i = 0; i < n; i++) {
			int idx = (int) Math.random() * n;
			int temp = arr[i];
			arr[i] = arr[idx];
			arr[idx] = temp;
		}
		Arrays.sort(arr);
	}

	public static void print(long[][] dp) {
		for (long[] a : dp) {
			for (long ele : a) {
				System.out.print(ele + " ");
			}
			System.out.println();
		}
	}

	public static void print(int[][] dp) {
		for (int[] a : dp) {
			for (int ele : a) {
				System.out.print(ele + " ");
			}
			System.out.println();
		}
	}

	public static void print(int[] dp) {
		for (int i = 0; i < 11; i++) {
			System.out.print(dp[i] + " ");
		}
		System.out.println();
	}

	public static void print(long[] dp) {
		for (long ele : dp) {
			System.out.print(ele + " ");
		}
		System.out.println();
	}

}