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
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
Shining through the city with a little funk and soul
*******************************
300iq as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class x825B
   {
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         char[][] grid = new char[10][10];
         for(int r=0; r < 10; r++)
            grid[r] = infile.readLine().toCharArray();
         String res = "NO";
         for(int r=0; r < 10; r++)
            for(int c=0; c < 10; c++)
               if(works(r, c, grid))
                  res = "YES";
         System.out.println(res);
      }
      public static boolean works(int r, int c, char[][] grid)
      {
         ArrayList<Integer> ls = new ArrayList<Integer>();
         for(int i=r; i <= r+4; i++)
         {
            ls.add(i);
            ls.add(c);
         }
         if(yay(ls, grid))
            return true;
         ls = new ArrayList<Integer>();
         for(int i=c; i <= c+4; i++)
         {
            ls.add(r);
            ls.add(i);
         }
         if(yay(ls, grid))
            return true;
         ls = new ArrayList<Integer>();
         for(int d=0; d < 5; d++)
         {
            ls.add(r+d);
            ls.add(c+d);
         }
         if(yay(ls, grid))
            return true;
         ls = new ArrayList<Integer>();
         for(int d=0; d < 5; d++)
         {
            ls.add(r+d);
            ls.add(c-d);
         }
         return yay(ls, grid);
      }
      public static boolean yay(ArrayList<Integer> ls, char[][] grid)
      {
         for(int x: ls)
            if(x < 0 || x >= 10)
               return false;
         int xc = 0;
         int dc = 0;
         for(int i=0; i < ls.size(); i+=2)
         {
            char c = grid[ls.get(i)][ls.get(i+1)];
            if(c == 'X')
               xc++;
            else if(c == '.')
               dc++;
         }
         return xc == 4 && dc == 1;
      }
   }