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.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;

public class B825{

	void solve()
	{
		char[][] gr = new char[10][];
		for(int i=0;i<10;i++)
			gr[i] = ca(10);
		
		boolean done = false;
		for(int i=0;i<10;i++)
			for(int j=0;j<10;j++)
				if(gr[i][j] == '.')
				{
					gr[i][j] = 'X';
					done |= check(gr);
					gr[i][j] = '.';
				}
		
		out.println(done ? "YES" : "NO");
	}
	
	boolean check(char[][] map)
	{
		boolean five = false;
		int cn = 0;
		for(int i=0;i<10;i++)
		{
			cn = 0;
			for(int j=0;j<10;j++)
			{
				if(map[i][j] == 'X')
					cn++;
				else
					cn = 0;
				five |= (cn == 5);
			}
		}
		
		for(int i=0;i<10;i++)
		{
			cn = 0;
			for(int j=0;j<10;j++)
			{
				if(map[j][i] == 'X')
					cn++;
				else
					cn = 0;
				five |= (cn == 5);
			}
		}
		
		{
			int x = 0, y = 0;
			while(x < 10)
			{
				cn = 0;
				for(int i=x,j=y;i>=0 && j<10;i--,j++)
				{
					if(map[i][j] == 'X')
						cn++;
					else
						cn = 0;
					five |= (cn == 5);
				}
				x++;
			}
			x = 9; y = 1;
			while(y < 10)
			{
				cn = 0;
				for(int i=x,j=y;i>=0 && j<10;i--,j++)
				{
					if(map[i][j] == 'X')
						cn++;
					else
						cn = 0;
					five |= (cn == 5);
				}
				y++;
			}
		}
		
		{
			int x = 9, y = 0;
			while(x >= 0)
			{
				cn = 0;
				for(int i=x,j=y;i<10 && j<10;i++,j++)
				{
					if(map[i][j] == 'X')
						cn++;
					else
						cn = 0;
					five |= (cn == 5);
				}
				x--;
			}
			x = 0; y = 1;
			while(y < 10)
			{
				cn = 0;
				for(int i=x,j=y;i<10 && j<10;i++,j++)
				{
					if(map[i][j] == 'X')
						cn++;
					else
						cn = 0;
					five |= (cn == 5);
				}
				y++;
			}
		}
		
		return five;
	}
	
	public static void main(String[] args){new B825().run();}
	
	private byte[] bufferArray = new byte[1024];
	private int bufLength = 0;
	private int bufCurrent = 0;
	InputStream inputStream;
	PrintWriter out;
	
	public void run()
	{
		inputStream = System.in;
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}
	
	int nextByte()
	{
		if(bufLength==-1)
			throw new InputMismatchException();
		if(bufCurrent>=bufLength)
		{
			bufCurrent = 0;
			try
			{bufLength = inputStream.read(bufferArray);}
			catch(IOException e)
			{ throw new InputMismatchException();}
			if(bufLength<=0)
				return -1;
		}
		return bufferArray[bufCurrent++];
	}
	
	boolean isSpaceChar(int x)
	{return (x<33 || x>126);}
	
	boolean isDigit(int x)
	{return (x>='0' && x<='9');}
	
	int nextNonSpace()
	{
		int x;
		while((x=nextByte())!=-1 && isSpaceChar(x));
		return x;
	}
	
	int ni()
	{
		long ans = nl();
		if ( Integer.MIN_VALUE <= ans && ans <= Integer.MAX_VALUE )
			return (int)ans;
		throw new InputMismatchException();
	}
	
	long nl()
	{
		long ans = 0;
		boolean neg = false;
		int x = nextNonSpace();
		if(x=='-') 
		{
			neg = true;
			x = nextByte();
		}
		while(!isSpaceChar(x))
		{
			if(isDigit(x))
			{
				ans = ans*10 + x -'0';
				x = nextByte();
			}
			else
				throw new InputMismatchException();
		}
		return neg ? -ans:ans;
	}
	
	String ns()
	{
		StringBuilder sb = new StringBuilder();
		int x = nextNonSpace();
		while(!isSpaceChar(x))
		{
			sb.append((char)x);
			x = nextByte();
		}
		return sb.toString();
	}
	
	char nc()
	{ return (char)nextNonSpace();}
	
	double nd()
	{ return (double)Double.parseDouble(ns()); }
	
	char[] ca()
	{ return ns().toCharArray();}
	
	char[] ca(int n)
	{
		char[] ans = new char[n];
		int p =0;
		int x = nextNonSpace();
		while(p<n)
		{
			ans[p++] = (char)x;
			x = nextByte();
		}
		return ans;
	}
	
	int[] ia(int n)
	{
		int[] ans = new int[n];
		for(int i=0;i<n;i++)
			ans[i]=ni();
		return ans;
	}
	
}
