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 javax.print.attribute.standard.MediaPrintableArea;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.io.*;
import java.util.*;
/**
 * Created by Firеfly on 1/1/2017.
 */
public class Task {
    public static void main(String[] args) throws IOException {
        Emaxx emaxx = new Emaxx();
    }
}


class Emaxx {
    FScanner fs;
    PrintWriter pw;
    int n, off, m, k;
    Integer W;
    ArrayList<Integer>[] graph;
    int[][] to;
    double[] comes, zh;
    int[] nums, res;
    LinkedList<Pair> qoue;
    boolean[] flags;
    Emaxx() throws IOException {
        fs = new FScanner(new InputStreamReader(System.in));
        // pw = new PrintWriter(new FileWriter("arithnumbers.out"));
        //  fs = new FScanner(new FileReader("C:\\Users\\Firеfly\\Desktop\\New Text Document.txt"));
        //     fs = new FScanner(new FileReader("input.txt"));;
        //       pw = new PrintWriter("output.txt");
        PrintWriter pw = new PrintWriter(System.out);
        char[][] cube = new char[10][];
        for (int i = 0; i<10; i++)
            cube[i] = fs.nextLine().toCharArray();
        boolean done = false;
        for (int i = 0; i<10; i++)
            for (int j =0 ; j<10; j++) {
            if (cube[i][j] == '.')
            if (check(cube, i, j))
            {
                System.out.println("YES");
                System.exit(0);
            }
        }
        System.out.println("NO");
        pw.close();
    }

    private boolean check(char[][] cube, int q, int w) {
        int gor =0, ver = 0, crosslr =0, crossrl = 0;
        for (int i = w-1; i>=0; i--) {
            if (cube[q][i] == 'X')
                gor++;
            else break;
        }
        for (int i = w+1; i<10; i++)
            if (cube[q][i] == 'X')
                gor++;
            else break;
        for (int i = q-1; i>=0; i--)
            if (cube[i][w] == 'X')
                ver++;
            else break;
        for (int i = q+1; i<10; i++)
            if (cube[i][w] == 'X')
                ver++;
        else break;
        int i = q-1, j = w-1;
        while (i>=0 && j >=0)
            if (cube[i--][j--] == 'X')
                crosslr++;
            else break;
        i = q+1; j=w+1;
        while (i<10 && j<10)
            if (cube[i++][j++] == 'X')
                crosslr++;
            else break;
        i = q+1; j = w-1;
        while (i<10 && j>=0)
            if (cube[i++][j--] == 'X')
                crossrl++;
            else break;
        i = q-1; j = w+1;
        while (i>=0 && j<10)
            if (cube[i--][j++] == 'X')
                crossrl++;
            else break;
        if (gor >=4 || ver >=4 || crosslr>=4 || crossrl>=4)
            return true;
        else return false;

    }


}


class Triple implements Comparable<Triple> {
    int t, ni, k;
    Triple(int x1, int y1, int c1) {
        t = x1; ni = y1; k = c1;
    }

    @Override
    public int compareTo(Triple triple) {
        return Integer.compare(t, triple.t);
    }
}
class Pair implements Comparable<Pair>{
    long x, y;
    Pair(int x1, int y1) {x = x1; y = y1;}
    Pair(){}
    @Override
    public int compareTo(Pair o) {
        return Long.compare(x, o.x);
    }
}

class Algs {
    public static int[] Z_f(char[] s) {
        int[] zf = new int[s.length];
        zf[0] = -1;
        int l = 0, r= 0;
        for (int i = 1; i<s.length; i++) {
            if (i>r)
            {
                int g = i;
                while (g < s.length && s[g] == s[g-i])
                    g++;
                if (g == i)
                    continue;
                l = i;
                r = g-1;
                zf[i] = g-i;
            } else {
                if (zf[i-l]<=r-i+1)
                    zf[i] = zf[i-l];
                else {
                    int g = r+1;
                    while (g <s.length && s[g] == s[g-i])
                        g++;
                    if (g == r+1)
                        zf[i] = r-i+1;
                    else {
                        zf[i] = g-i;
                        r = g-1;
                        l = i;
                    }
                }
            }
        }
        return zf;
    }
}



class FScanner {
    BufferedReader br;
    StringTokenizer st;
    FScanner(InputStreamReader isr) {
        br = new BufferedReader(isr);
    }

    FScanner(FileReader fr) {
        br = new BufferedReader(fr);
    }

    String nextToken() throws IOException{
        while (st == null || !st.hasMoreTokens()) {
            String s = br.readLine();
            if (s == null)
                return null;
            st = new StringTokenizer(s);
        }
        return st.nextToken();
    }

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

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

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

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

    char nextChar() throws IOException {
        return (char) br.read();
    }
}
