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 {
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
//        InputStream inputStream = new FileInputStream("sum.in");
        OutputStream outputStream = System.out;
//        OutputStream outputStream = new FileOutputStream("sum.out");


//        Path path = Paths.get(URI.create("file:///foo/bar/Main.java"));
//        System.out.print(path.getName(200));

//        Path p = Paths.get("/foo/bar/Main.java");
//        for (Path e : p) {
//            System.out.println(e);
//        }

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Answer solver = new Answer();
        solver.solve(in, out);
        out.close();
    }
}

class Answer {
    private final int INF = (int) (1e9 + 7);
    private final int MOD = (int) (1e9 + 7);
    private final int MOD1 = (int) (1e6 + 3);
    private final long INF_LONG = (long) (1e18 + 1);
    private final double EPS = 1e-9;


    private int kolRow(String[] s, int x, int y) {
        int kol = 0;
        int i = y - 1;
        while (i >= 0 && s[x].charAt(i) == 'X') {
            i--;
            kol++;
        }
        i = y + 1;
        while (i < 10 && s[x].charAt(i) == 'X') {
            i++;
            kol++;
        }
        return kol;
    }

    private int kolCol(String[] s, int x, int y) {
        int kol = 0;
        int j = x - 1;
        while (j >= 0 && s[j].charAt(y) == 'X') {
            j--;
            kol++;
        }
        j = x + 1;
        while (j < 10 && s[j].charAt(y) == 'X') {
            j++;
            kol++;
        }
        return kol;
    }

    private int kolD1(String[] s, int x, int y) {
        int kol = 0;
        int i = x - 1;
        int j = y - 1;
        while (i >= 0 && j >= 0 && s[i].charAt(j) == 'X') {
            i--;
            j--;
            kol++;
        }
        i = x + 1;
        j = y + 1;
        while (i < 10 && j < 10 && s[i].charAt(j) == 'X') {
            i++;
            j++;
            kol++;
        }
        return kol;
    }

    private int kolD2(String[] s, int x, int y) {
        int kol = 0;
        int i = x - 1;
        int j = y + 1;
        while (i >= 0 && j < 10 && s[i].charAt(j) == 'X') {
            i--;
            j++;
            kol++;
        }
        i = x + 1;
        j = y - 1;
        while (i < 10 && j >= 0 && s[i].charAt(j) == 'X') {
            i++;
            j--;
            kol++;
        }
        return kol;
    }

    public void solve(InputReader in, PrintWriter out) throws IOException {
        String[] s = new String[10];
        for (int i = 0; i < 10; i++) {
            s[i] = in.next();
        }

        for (int i = 0; i <10; i++) {
            for (int j = 0; j < 10; j++) {
                if (s[i].charAt(j) == '.') {
                    if (kolRow(s, i, j) >= 4 || kolCol(s, i, j) >= 4 || kolD1(s, i, j) >= 4 || kolD2(s, i, j) >= 4) {
                        out.print("YES");
                        return;
                    }
                }
            }
        }

        out.print("NO");
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

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

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

    public int[] nextArrayInt(int count) {
        int[] a = new int[count];
        for (int i = 0; i < count; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    public long[] nextArrayLong(int count) {
        long[] a = new long[count];
        for (int i = 0; i < count; i++) {
            a[i] = nextLong();
        }
        return a;
    }
}
