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.*;
import java.util.*;

public class Main {
    static FastScanner in;
    static PrintWriter out;
    static final int MOD = 1000000007;

    public static void main(String[] args) throws IOException {
        //        Scanner in = new Scanner(new File("input.txt"));
        //        Scanner in = new Scanner(System.in);
        //        System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream("output.txt")), true));
        out = new PrintWriter(System.out);
        in = new FastScanner(System.in);
        //        in = new FastScanner("input.txt");
        char s[][] = new char[10][10];
        for (int i = 0; i < 10; i++) {
            s[i] = in.next().toCharArray();
        }
        String ans = "NO";
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                if (s[i][j] == '.') {
                    s[i][j] = 'X';
                    for (int ii = 0; ii < 10; ii++) {
                        for (int jj = 0; jj <= 5; jj++) {
                            if (s[ii][jj] == 'X' && s[ii][jj + 1] == 'X' && s[ii][jj + 2] == 'X' && s[ii][jj + 3] == 'X'
                                    && s[ii][jj + 4] == 'X')
                                ans = "YES";
                        }
                    }
                    for (int jj = 0; jj < 10; jj++) {
                        for (int ii = 0; ii <= 5; ii++) {
                            if (s[ii][jj] == 'X' && s[ii + 1][jj] == 'X' && s[ii + 2][jj] == 'X' && s[ii + 3][jj] == 'X'
                                    && s[ii + 4][jj] == 'X')
                                ans = "YES";
                        }
                    }
                    for (int ii = 0; ii <= 5; ii++) {
                        for (int jj = 0; jj <= 5; jj++) {
                            if (s[ii][jj] == 'X' && s[ii + 1][jj + 1] == 'X' && s[ii + 2][jj + 2] == 'X'
                                    && s[ii + 3][jj + 3] == 'X' && s[ii + 4][jj + 4] == 'X')
                                ans = "YES";
                        }
                    }
                    for (int ii = 0; ii <= 5; ii++) {
                        for (int jj = 4; jj < 10; jj++) {
                            if (s[ii][jj] == 'X' && s[ii + 1][jj - 1] == 'X' && s[ii + 2][jj - 2] == 'X'
                                    && s[ii + 3][jj - 3] == 'X' && s[ii + 4][jj - 4] == 'X')
                                ans = "YES";
                        }
                    }
                    s[i][j] = '.';
                }
            }
        }
        out.println(ans);
        out.close();
    }
}

class Pair {
    public int first; //first member of pair
    public int second; //second member of pair

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

    public Pair() {

    }
}

class FastScanner {

    BufferedReader br;
    StringTokenizer tokenizer;

    FastScanner(String fileName) throws FileNotFoundException {
        this(new FileInputStream(new File(fileName)));
    }

    FastScanner(InputStream is) {
        br = new BufferedReader(new InputStreamReader(is));
    }

    String nextLine() throws IOException {
        tokenizer = null;
        return br.readLine();
    }

    String next() throws IOException {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null) {
                return null;
            }
            tokenizer = new StringTokenizer(line);
        }
        return tokenizer.nextToken();
    }

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

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

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    char nextChar() throws IOException {
        return next().charAt(0);
    }
}