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.*;
import java.lang.*;
import java.io.*;
import java.math.*;
public class Prac{     
    static class InputReader { 
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        public InputReader(InputStream st) {
            this.stream = st;
        } 
        public int read() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } 
                catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
        public int ni() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        } 
        public long nl() {
            int c = read();
            while (isSpaceChar(c)) {
            c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        } 
        public int[] nia(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        } 
        public String rs() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                    c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        } 
        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        } 
    }
    public static class Key {

        private final int x;
        private final int y;

        public Key(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof Key)) return false;
            Key key = (Key) o;
            return x == key.x && y == key.y;
        }

        @Override
        public int hashCode() {
            int result = x;
            result = 31 * result + y;
            return result;
        }

    }
    static class Pair{
        int x,y;
        public Pair(int x,int y){
            this.x=x;
            this.y=y;
            
        }
    }
    
    static PrintWriter w = new PrintWriter(System.out);
    static long mod=998244353L,mod1=1000000007;
    static class Pai{
        Integer i;
        String s;
        public Pai(Integer i,String s){
            this.i=i;
            this.s=s;
        }
    }
    public static void main(String [] args){
        InputReader sc=new InputReader(System.in);
        char arr[][]=new char[10][10];
        for(int i=0;i<10;i++){
            arr[i]=sc.nextLine().toCharArray();
            
        }
        int x=0,y=0;
        boolean f=false;
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                if(arr[i][j]=='.'){
                    int lc=0,rc=0,uc=0,dc=0;
                    x=i;y=j-1;
                    while(y>=0&&arr[x][y]=='X'){
                        y--;lc++;
                    }
                    x=i;y=j+1;
                    while(y<10&&arr[x][y]=='X'){
                        y++;rc++;
                    }
                    x=i-1;y=j;
                    while(x>=0&&arr[x][y]=='X'){
                        x--;uc++;
                    }
                    x=i+1;y=j;
                    while(x<10&&arr[x][y]=='X'){
                        x++;dc++;
                    }
                    
                    x=i-1;y=j-1;
                    int lduc=0,rduc=0,lddc=0,rddc=0;
                    while(y>=0&&x>=0&&arr[x][y]=='X'){
                        y--;lduc++;x--;
                    }
                    x=i+1;y=j+1;
                    while(y<10&&x<10&&arr[x][y]=='X'){
                        x++;y++;
                        rddc++;
                    }
                    x=i-1;y=j+1;
                    while(x>=0&&y<10&&arr[x][y]=='X'){
                        x--;y++;
                        rduc++;
                    }
                    x=i+1;y=j-1;
                    while(x<10&&y>=0&&arr[x][y]=='X'){
                        x++;y--;
                        lddc++;
                    }
                    lc+=rc;
                    uc+=dc;
                    lduc+=rddc;
                    lddc+=rduc;
                    if(lc>=4||uc>=4||lduc>=4||lddc>=4)f=true;
                    
                }
                
                
               
            }
        }
        w.println(f?"YES":"NO");
        w.close();
    }
}