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.io.*;

public class CFEdu25B {
	public static void main(String args[]) {
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		/*------------------------------My Code starts here------------------------------*/
		char[][] a=new char[10][10];
		int i,j,k,x=0,o=0;
		boolean b=false;
		for(i=0;i<10;i++)
		{
			String s=in.next();
			for(j=0;j<10;j++)
				a[i][j]=s.charAt(j);
		}
		for(i=0;i<=5;i++)
		{
			for(j=0;j<10;j++)
			{
				x=0;
				o=0;
				if(a[i][j]=='X')
					x++;
				else if(a[i][j]=='.')
					o++;
				if(a[i+1][j]=='X')
					x++;
				else if(a[i+1][j]=='.')
					o++;
				if(a[i+2][j]=='X')
					x++;
				else if(a[i+2][j]=='.')
					o++;
				if(a[i+3][j]=='X')
					x++;
				else if(a[i+3][j]=='.')
					o++;
				if(a[i+4][j]=='X')
					x++;
				else if(a[i+4][j]=='.')
					o++;
				if((x==4 && o==1) || (x==5))
					b=true;
			}
		}
		for(i=0;i<10;i++)
		{
			for(j=0;j<=5;j++)
			{
				x=0;
				o=0;
				if(a[i][j]=='X')
					x++;
				else if(a[i][j]=='.')
					o++;
				if(a[i][j+1]=='X')
					x++;
				else if(a[i][j+1]=='.')
					o++;
				if(a[i][j+2]=='X')
					x++;
				else if(a[i][j+2]=='.')
					o++;
				if(a[i][j+3]=='X')
					x++;
				else if(a[i][j+3]=='.')
					o++;
				if(a[i][j+4]=='X')
					x++;
				else if(a[i][j+4]=='.')
					o++;
				if((x==4 && o==1) || (x==5))
					b=true;
			}
		}
		for(i=0;i<=5;i++)
		{
			for(j=0;j<=5;j++)
			{
				x=0;
				o=0;
				if(a[i][j]=='X')
					x++;
				else if(a[i][j]=='.')
					o++;
				if(a[i+1][j+1]=='X')
					x++;
				else if(a[i+1][j+1]=='.')
					o++;
				if(a[i+2][j+2]=='X')
					x++;
				else if(a[i+2][j+2]=='.')
					o++;
				if(a[i+3][j+3]=='X')
					x++;
				else if(a[i+3][j+3]=='.')
					o++;
				if(a[i+4][j+4]=='X')
					x++;
				else if(a[i+4][j+4]=='.')
					o++;
				if((x==4 && o==1) || (x==5))
					b=true;
			}
		}
		for(i=0;i<=5;i++)
		{
			for(j=4;j<10;j++)
			{
				x=0;
				o=0;
				if(a[i][j]=='X')
					x++;
				else if(a[i][j]=='.')
					o++;
				if(a[i+1][j-1]=='X')
					x++;
				else if(a[i+1][j-1]=='.')
					o++;
				if(a[i+2][j-2]=='X')
					x++;
				else if(a[i+2][j-2]=='.')
					o++;
				if(a[i+3][j-3]=='X')
					x++;
				else if(a[i+3][j-3]=='.')
					o++;
				if(a[i+4][j-4]=='X')
					x++;
				else if(a[i+4][j-4]=='.')
					o++;
				if((x==4 && o==1) || (x==5))
					b=true;
			}
		}
		out.println((b)?("YES"):("NO"));
		out.close();
		/*------------------------------The End------------------------------------------*/
	}

	public static final long l = (int) (1e9 + 7);

	private static Integer[] nextIntArray(InputReader in, int n) {
		Integer[] a = new Integer[n];
		for (int i = 0; i < n; i++)
			a[i] = in.nextInt();
		return a;
	}

	private static long[] nextLongArray(InputReader in, int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = in.nextLong();
		return a;
	}

	private static int[][] nextIntMatrix(InputReader in, int n, int m) {
		int[][] a = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++)
				a[i][j] = in.nextInt();
		}
		return a;
	}

	private static void show(Integer[] a) {
		for (int i = 0; i < a.length; i++)
			System.out.print(a[i] + " ");
		System.out.println();
	}

	private static void show2DArray(char[][] a) {
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[0].length; j++)
				System.out.print(a[i][j]);
			System.out.println();
		}
	}

	static class Pair {
		private int first;
		private int second;

		public Pair(int i, int j) {
			this.first = i;
			this.second = j;
		}

		public int getFirst() {
			return first;
		}

		public int getSecond() {
			return second;
		}

		public void setFirst(int k) {
			this.first = k;
		}

		public void setSecond(int k) {
			this.second = k;
		}
	}

	static int modPow(int a, int b, int p) {
		int result = 1;
		a %= p;
		while (b > 0) {
			if ((b & 1) != 0)
				result = (result * a) % p;
			b = b >> 1;
			a = (a * a) % p;
		}
		return result;
	}

	public static void SieveOfEratosthenes(int n) {
		boolean[] prime = new boolean[n + 1];
		Arrays.fill(prime, true);
		prime[1] = false;
		int i, j;
		for (i = 2; i * i <= n; i++) {
			if (prime[i]) {
				for (j = i; j <= n; j += i) {
					if (j != i)
						prime[j] = false;
				}
			}
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine() {
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine = reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
	}

}
