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

public class AB
{
    static class Scan
    {
        final private int BUF_SIZE = 1 << 16;
        private int cur_size = 0;
        private int pointer = 0;
        private java.io.DataInputStream in;
        private byte buffer[] = new byte[BUF_SIZE];

        Scan(java.io.InputStream input)
        {
            in = new java.io.DataInputStream(input);
        }

        // fills the buffer with characters
        private void fill() throws java.io.IOException
        {
            cur_size = in.read(buffer, 0, BUF_SIZE);
            if (cur_size == -1) buffer[0] = 0;
            pointer = 0;
        }

        private byte read() throws java.io.IOException
        {
            if (pointer == cur_size) fill();
            return buffer[pointer++];
        }

        int readInt() throws java.io.IOException
        {
            int res = 0;
            byte c;
            while ((c = read()) <= ' ');
            boolean negate = c == '-';
            if (negate) c = read();
            while (c >= '0' && c <= '9')
            {
                res = res * 10 + c - '0';
                c = read();
            }
            return negate ? -res : res;
        }

        long readLong() throws java.io.IOException
        {
            long res = 0;
            byte c;
            while ((c = read()) <= ' ') ;
            boolean negate = c == '-';
            if (negate) c = read();
            while (c >= '0' && c <= '9') {
                res = res * 10 + c - '0';
                c = read();
            }
            return negate ? -res : res;
        }

        double readDouble() throws java.io.IOException
        {
            byte c;
            while ((c = read()) <= ' ');
            boolean negate = c == '-';
            if (negate)
                c = read();
            int power = 0;
            long res = 0;
            boolean dot_flag = false;
            for (;(c >= '0' && c <= '9') || c == '.'; c = read())
            {
                if (dot_flag)
                    power++;
                if (c == '.')
                    dot_flag = true;
                else
                    res = res * 10 + c - '0';
            }
            double ret = res / Math.pow(10, power);
            return negate ? -ret : ret;
        }

        // skip defines whether ' ', '\n', '\r' must be skipped in readChar method
        char readChar(boolean skip) throws java.io.IOException
        {
            if (skip)
            {
                byte c;
                while ((c = read()) == ' ' || c == '\n' || c == '\r');
                return (char) c;
            }
            return (char) read();
        }

        // skip defines whether current string must be skipped in readString and readText methods

        /* If exact length is known, in terms of efficiency
         it is better to specify it while using readText, readString and readWord methods */

        String readWord() throws java.io.IOException
        {
            byte c;
            while ((c = read()) == '\n' || c == ' ' || c == '\r');
            StringBuilder s = new StringBuilder();
            s.append((char)c);
            for (;(c = read()) != '\n' && c != ' ' && c != '\r' && c != 0; s.append((char)c));
            return s.toString();
        }

        String readWord(int LEN) throws java.io.IOException
        {
            byte[] s = new byte[LEN];
            byte c;
            while ((c = read()) == '\n' || c == ' ' || c == '\r');
            s[0] = c;
            for (int i = 1; (c = read()) != ' ' && c != '\n' && c != '\r' && c != 0; s[i++] = c);
            return new String(s);
        }

        String readString(boolean skip, int LEN) throws java.io.IOException
        {
            byte[] s = new byte[LEN];
            byte c;
            if (skip)
                while ((c = read()) != '\n');
            for (int i = 0; (c = read()) != '\n' && c != '\r' && c != 0; s[i++] = c);
            read();
            return new String(s);
        }

        String readString(boolean skip) throws java.io.IOException
        {
            StringBuilder s = new StringBuilder("");
            byte c;
            if (skip)
                while ((c = read()) != '\n');
            for (;(c = read()) != '\n' && c != '\r' && c != 0; s.append((char)c));
            read();
            return s.toString();
        }

        String readText(boolean skip, int LEN) throws java.io.IOException
        {
            byte[] s = new byte[LEN];
            byte c;
            if (skip)
                while ((c = read()) != '\n');
            for (int i = 0; (c = read()) != 0; s[i++] = c);
            return new String(s);
        }

        String readText(boolean skip) throws java.io.IOException
        {
            StringBuilder s = new StringBuilder("");
            byte c;
            if (skip)
                while ((c = read()) != '\n');
            for (;(c = read()) != 0; s.append((char)c));
            return s.toString();
        }
    }

    static class Pair<T1 extends Comparable<T1>, T2 extends Comparable<T2>> implements Comparable<Pair<T1, T2>>
    {
        T1 left;
        T2 right;

        Pair(T1 l, T2 r)
        {
            left = l;
            right = r;
        }

        public String toString()
        {
            return left + " " + right;
        }

        public int compareTo(Pair<T1, T2> e)
        {
            if (left.compareTo(e.left) > 0) return 1;
            if (left.compareTo(e.left) < 0) return -1;
            if (right.compareTo(e.right) > 0) return 1;
            if (right.compareTo(e.right) < 0) return -1;
            return 0;
        }

        public int hashCode()
        {
            return (int)((left.hashCode() * (Integer.MAX_VALUE + 1L) + right.hashCode()) % Integer.MAX_VALUE);
        }

        public boolean equals(Object o)
        {
            return (o instanceof Pair) && (((Pair) o).left == this.left) && (((Pair) o).right == this.right);
        }
    }

    static class Triplet<T1 extends Comparable<T1>, T2 extends Comparable<T2>, T3 extends Comparable<T3>>
            implements Comparable<Triplet<T1, T2, T3>>
    {
        private T1 left;
        private T2 mid;
        private T3 right;

        Triplet(T1 l, T2 m, T3 r)
        {
            left = l;
            mid = m;
            right = r;
        }

        T1 getLeft()
        {
            return left;
        }

        T2 getMid()
        {
            return mid;
        }

        T3 getRight()
        {
            return right;
        }

        public int compareTo(Triplet<T1, T2, T3> e)
        {
            if (left.compareTo(e.getLeft()) > 0) return 1;
            if (left.compareTo(e.getLeft()) < 0) return -1;
            if (mid.compareTo(e.getMid()) > 0) return 1;
            if (mid.compareTo(e.getMid()) < 0) return -1;
            if (right.compareTo(e.getRight()) > 0) return 1;
            if (right.compareTo(e.getRight()) < 0) return -1;
            return 0;
        }

        public String toString()
        {
            return left + " " + mid + " " + right;
        }
    }


    static boolean check(char[][] matrix)
    {
        for (int i = 0; i < 10; i++)
            for (int j = 0; j <= 5; j++)
                if (matrix[i][j] == 'X' && matrix[i][j + 1] == 'X' && matrix[i][j + 2] == 'X' && matrix[i][j + 3] == 'X' && matrix[i][j + 4] == 'X')
                    return true;
        for (int i = 0; i <= 5; i++)
            for (int j = 0; j < 10; j++)
                if (matrix[i][j] == 'X' && matrix[i + 1][j] == 'X' && matrix[i + 2][j] == 'X' && matrix[i + 3][j] == 'X' && matrix[i + 4][j] == 'X')
                    return true;
        for (int i = 0; i <= 5; i++)
            for (int j = 0; j <= 5; j++)
                if (matrix[i][j] == 'X' && matrix[i + 1][j + 1] == 'X' && matrix[i + 2][j + 2] == 'X' && matrix[i + 3][j + 3] == 'X' && matrix[i + 4][j + 4] == 'X')
                    return true;
        for (int i = 0; i <= 5; i++)
            for (int j = 4; j < 10; j++)
                if (matrix[i][j] == 'X' && matrix[i + 1][j - 1] == 'X' && matrix[i + 2][j - 2] == 'X' && matrix[i + 3][j - 3] == 'X' && matrix[i + 4][j - 4] == 'X')
                    return true;
        return false;
    }


    public static void main(String[] args) throws Exception
    {
        Scan in = new Scan(System.in);
        char m[][] = new char[10][10];
        for (int i = 0; i < 10; i++)
            for (int j = 0; j < 10; j++)
                m[i][j] = in.readChar(true);
        for (int i = 0; i < 10; i++)
            for (int j = 0; j < 10; j++)
            {
                if (m[i][j] == '.')
                {
                    m[i][j] = 'X';
                    if (check(m))
                    {
                        System.out.println("YES");
                        return;
                    }
                    m[i][j] = '.';
                }
            }
        System.out.println("NO");
    }
}