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.Scanner;
public class Main{
    public static void main(String args[]){
        //New Game.
        Five_In_a_Row newGame = new Five_In_a_Row();
        //Getting Grid.
        newGame.loadGrid();
        //result.
        if(newGame.finalVerdict())
            System.out.println("YES");
        else System.out.println("NO");
    }
    //For console input.
    public static Scanner read = new Scanner(System.in);
}
class Five_In_a_Row{
    //Function to Present Final Verdict.
    public boolean finalVerdict(){
        boolean [] allVerdicts = new boolean[4];
        //Collecting all Veridicts.
        allVerdicts[0] = checkAllHorizontalSegments();
        allVerdicts[1] = checkAllVerticalSegments();
        allVerdicts[2] = checkAllPrimarySegments();
        allVerdicts[3] = checkAllSecondrySegments();
        //final Verdict.
        return allVerdicts[0]||allVerdicts[1]||
            allVerdicts[2]||allVerdicts[3];
    }
    //Function to Check all primary diagonal Segemnts.
    public boolean checkAllPrimarySegments(){
        boolean found = false,contiueSearch = true;
        for (int i = 0;i<=segLength && !found;++i){
            for (int j = 0;j<=segLength && contiueSearch;++j){
                contiueSearch = !helpPrimary(i,j);
            }
            if(!contiueSearch)
                found = !found;
        }
        return found;
    }
    //Function to Check all secondry diagonal Segemnts.
    public boolean checkAllSecondrySegments(){
        boolean found = false,contiueSearch = true;
        for (int i = 0;i<=segLength && !found;++i){
            for (int j = segLength-1;j<grid.length && contiueSearch;++j){
                contiueSearch = !helpSecondry(i,j);
            }
            if(!contiueSearch)
                found = !found;
        }
        return found;
    }
    //Function to Check all horizontal Segments.
    public boolean checkAllHorizontalSegments(){
        boolean found = false,contiueSearch = true;
        for (int i = 0;i<grid.length && !found;++i){
            for (int j = 0;j<=segLength && contiueSearch;++j){
                contiueSearch = !helpHorizontal(i,j);
            }
            if(!contiueSearch)
                found = !found;
        }
        return found;
    }
    //Function to Check all vertical Segments.
    public boolean checkAllVerticalSegments(){
        boolean found = false,contiueSearch = true;
        for (int i = 0;i<grid.length && !found;++i){
            for (int j = 0;j<=segLength && contiueSearch;++j){
                contiueSearch = !helpVertical(i,j);
            }
            if(!contiueSearch)
                found = !found;
        }
        return found;
    }
    //Function to Check a primary diagonal Segemnt.
    public boolean helpPrimary(int rowX,int colX){
        int crossCount = 0,dotCount = 0;
        for (int x=0;x<=segLength-1;++x){
            if(this.grid[x+rowX][x+colX] == 'X')
                ++crossCount;
            else if (this.grid[x+rowX][x+colX] == '.')
                ++dotCount;
        }
        return crossCount == 4 && dotCount == 1;
    }
    //Function to Check a secondry diagonal Segemnt.
    public boolean helpSecondry(int rowX,int colX){
        int crossCount = 0,dotCount = 0;
        for (int x=0;x<=segLength-1;++x){
            if(this.grid[x+rowX][colX-x] == 'X')
                ++crossCount;
            else if (this.grid[x+rowX][colX-x] == '.')
                ++dotCount;
        }
        return crossCount == 4 && dotCount == 1;
    }
    //Function to Check a horizontal Segment.
    
    public boolean helpHorizontal(int rowX,int startX){
        int crossCount = 0,dotCount = 0;
        for (int x=startX;x<=startX+segLength-1;++x){
            if(this.grid[rowX][x] == 'X')
                ++crossCount;
            else if (this.grid[rowX][x] == '.')
                ++dotCount;
        }
        return crossCount == 4 && dotCount == 1;
    }
    //Function to Check a vertical Segment.
    public boolean helpVertical(int colX,int startX){
        int crossCount = 0,dotCount = 0;
        for (int x=startX;x<=startX+segLength-1;++x){
            if(this.grid[x][colX] == 'X')
                ++crossCount;
            else if (this.grid[x][colX] == '.')
                ++dotCount;
        }
        return crossCount == 4 && dotCount == 1;
    }
    //Function to get Grid from Codeforces.
    public void loadGrid(){
        String inpStr = "";
        for (int i = 0;i<grid.length;++i){
            inpStr = Main.read.next();
            for (int j = 0;j<inpStr.length();++j){
              this.grid[i][j] =  inpStr.charAt(j); 
            }
        }
    }
    //For Storing Game.
    private char [][] grid = new char [10][10];
    private int segLength = 5;
}
