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.FileNotFoundException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;
import java.lang.*;


/**
 * Created by Emil on 2016-12-17.
 */

public class Main {

    long snabbExponering(long b, long n, int mod) {
        int ans = 1;
        while(n!=0){
            if (n % 2 == 0) {
                b = b * b % mod;
                n = n / 2;
            } else {
                ans *= b;
                ans %= mod;
                n = n - 1;
            }
        }
        return ans;
    }

    void printArray(int[][] array) {
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[i].length; j++) {
                System.out.print(array[i][j]);
                System.out.print(" ");
            }
            System.out.println();
        }
    }

    void printArray(int[] array) {
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]);
            System.out.print(" ");
        }
        System.out.println();
    }

    void printArray(ArrayList array) {
        for (int i = 0; i < array.size(); i++) {
            System.out.print(array.get(i));
            System.out.print(" ");
        }
        System.out.println();
    }

    Boolean[] strTobools(String input){
        Boolean[] out = new Boolean[input.length()];
        for (int i = 0; i < input.length(); i++) {
            out[i] = ( (input.charAt(i)=='+')?true:false );
        }
        return out;
    }

    private List<String> bolToString(boolean[][] board) {
        List<String> ans = new ArrayList<>();
        for (int i = 0; i < board.length; i++) {
            StringBuilder sb = new StringBuilder();
            for (int j = 0; j < board.length; j++) {
                sb.append((board[i][j])?'Q':'.');
            }
            ans.add(sb.toString());
        }
        return  ans;
    }

    public static boolean[][] deepCopy(boolean[][] original) {
        if (original == null) {
            return null;
        }

        final boolean[][] result = new boolean[original.length][];
        for (int i = 0; i < original.length; i++) {
            result[i] = Arrays.copyOf(original[i], original[i].length);
        }
        return result;
    }

    //---------------------------------------------------------------------------------


    void solve (InputStream is, PrintStream ps) {
        Scanner input = new Scanner(is);;
        int n = 10;
        char[][] charArr = new char[n][n];
        for (int i = 0; i < n; i++) {
            charArr[i] = input.next().toCharArray();
        }
        int xcount = 0;
        int steps = 0;

        for (int i = 0; i < n; i++) {
            xcount = 0;
            steps = 0;
            for (int j = 0; j < n; j++) {
                if (charArr[i][j] == 'O') {
                    xcount = 0;
                    steps = 0;
                    if (n-j < 6) {
                        break;
                    }
                } else {
                    steps++;
                    if (charArr[i][j] == 'X') {
                        xcount++;
                    }
                    if (steps==5) {
                        if (xcount>=4) {
                            System.out.println("YES");
                            return;
                        } else {
                            steps--;
                            if (charArr[i][j-4] == 'X') {
                                xcount--;
                            }
                        }
                    }
                }
            }
        }

        for (int i = 0; i < n; i++) {
            xcount = 0;
            steps = 0;
            for (int j = 0; j < n; j++) {
                if (charArr[j][i] == 'O') {
                    xcount = 0;
                    steps = 0;
                    if (n-j < 6) {
                        break;
                    }
                } else {
                    steps++;
                    if (charArr[j][i] == 'X') {
                        xcount++;
                    }
                    if (steps==5) {
                        if (xcount>=4) {
                            System.out.println("YES");
                            return;
                        } else {
                            steps--;
                            if (charArr[j-4][i] == 'X') {
                                xcount--;
                            }
                        }
                    }
                }
            }
        }


        for (int i = 0; i < n-4; i++) {
            xcount = 0;
            steps = 0;
            for (int j = 0; j < n-i; j++) {
                if (charArr[i+j][j] == 'O') {
                    xcount = 0;
                    steps = 0;
                    if (n-i-j < 6) {
                        break;
                    }
                } else {
                    steps++;
                    if (charArr[i+j][j] == 'X') {
                        xcount++;
                    }
                    if (steps==5) {
                        if (xcount>=4) {
                            System.out.println("YES");
                            return;
                        } else {
                            steps--;
                            if (charArr[i+j-4][j-4] == 'X') {
                                xcount--;
                            }
                        }
                    }
                }
            }
        }

        for (int i = 0; i < n-4; i++) {
            xcount = 0;
            steps = 0;
            for (int j = 0; j < n-i; j++) {
                if (charArr[j][i+j] == 'O') {
                    xcount = 0;
                    steps = 0;
                    if (n-i-j < 6) {
                        break;
                    }
                } else {
                    steps++;
                    if (charArr[j][i+j] == 'X') {
                        xcount++;
                    }
                    if (steps==5) {
                        if (xcount>=4) {
                            System.out.println("YES");
                            return;
                        } else {
                            steps--;
                            if (charArr[j-4][i+j-4] == 'X') {
                                xcount--;
                            }
                        }
                    }
                }
            }
        }

        for (int i = 4; i < n; i++) {
            xcount = 0;
            steps = 0;
            for (int j = 0; j < i+1; j++) {
                if (charArr[i-j][j] == 'O') {
                    xcount = 0;
                    steps = 0;
//                    if (n-i-j < 6) {
//                        break;
//                    }
                } else {
                    steps++;
                    if (charArr[i-j][j] == 'X') {
                        xcount++;
                    }
                    if (steps==5) {
                        if (xcount>=4) {
                            System.out.println("YES");
                            return;
                        } else {
                            steps--;
                            if (charArr[i-j+4][j-4] == 'X') {
                                xcount--;
                            }
                        }
                    }
                }
            }
        }


        for (int i = 0; i < n-4; i++) {
            xcount = 0;
            steps = 0;
            for (int j = 0; j < n-i; j++) {
                if (charArr[n-1-j][i+j] == 'O') {
                    xcount = 0;
                    steps = 0;
//                    if (n-i-j < 6) {
//                        break;
//                    }
                } else {
                    steps++;
                    if (charArr[n-1-j][i+j] == 'X') {
                        xcount++;
                    }
                    if (steps==5) {
                        if (xcount>=4) {
                            System.out.println("YES");
                            return;
                        } else {
                            steps--;
                            if (charArr[n-1-j+4][i+j-4] == 'X') {
                                xcount--;
                            }
                        }
                    }
                }
            }
        }
        System.out.println("NO");
        //ps.println( (n>2) && (n%2 == 0) ? "YES" : "NO");
    }


    public static void main(String[] args) throws FileNotFoundException {
        //InputStream instream = new FileInputStream("C-large.in");
        Main obj = new Main();
        //PrintStream outstream = new PrintStream("output");
        new Main().solve(System.in, System.out);

    }



}
