/**
 * @author Finn Lidbetter
 */
import java.util.*;
import java.io.*;
import java.awt.geom.*;

public class TaskB {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();
    int n = 10;
    char[][] board = new char[n][n];
    for (int i=0; i<n; i++) {
      board[i] = br.readLine().toCharArray();
    }
    boolean poss = false;
    for (int i=0; i<n; i++) {
      for (int j=0; j<n-4; j++) {
        int nO = 0;
        int nX = 0;
        int nD = 0;
        for (int k=0; k<5; k++) {
          if (board[i][j+k]=='O') {
            nO++;
          } else if (board[i][j+k]=='X')
            nX++;
          else
            nD++;

        }
        if (nX==4 && nD==1)
          poss = true;
      }
    }
    for (int i=0; i<n-4; i++) {
      for (int j=0; j<n; j++) {
        int nO = 0;
        int nX = 0;
        int nD = 0;
        for (int k=0; k<5; k++) {
          if (board[i+k][j]=='O') {
            nO++;
          } else if (board[i+k][j]=='X')
            nX++;
          else
            nD++;
        }
        if (nX==4 && nD==1)
          poss = true;
      }
    }
    for (int i=0; i<n-4; i++) {
      for (int j=0; j<n-4; j++) {
        int nO = 0;
        int nX = 0;
        int nD = 0;
        for (int k=0; k<5; k++) {
          if (board[i+k][j+k]=='O') {
            nO++;
          } else if (board[i+k][j+k]=='X')
            nX++;
          else
            nD++;
        }
        if (nX==4 && nD==1)
          poss = true;
      }
    }
    for (int i=0; i<n-4; i++) {
      for (int j=4; j<n; j++) {
        int nO = 0;
        int nX = 0;
        int nD = 0;
        for (int k=0; k<5; k++) {
          if (board[i+k][j-k]=='O') {
            nO++;
          } else if (board[i+k][j-k]=='X')
            nX++;
          else
            nD++;
        }
        if (nX==4 && nD==1)
          poss = true;
      }
    }
    if (poss)
      System.out.println("YES");
    else
      System.out.println("NO");
  }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BFiveInARow solver = new BFiveInARow();
        solver.solve(1, in, out);
        out.close();
    }

    static class BFiveInARow {
        char[][] arr;

        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            arr = new char[10][10];
            for (int i = 0; i < 10; i++)
                arr[i] = sc.next().toCharArray();
            for (int i = 0; i < 10; i++)
                for (int j = 0; j < 10; j++) {
                    if (arr[i][j] == '.') {
                        arr[i][j] = 'X';
                        if (check() || checkDia()) {
                            pw.println("YES");
                            return;
                        }
                        arr[i][j] = '.';
                    }
                }
            pw.println("NO");
        }

        private boolean checkDia() {
            boolean f = false;
            for (int i = 0; i < 10; i++)
                for (int j = 0; j < 10; j++) {
                    if (arr[i][j] == 'X') {
                        int c = 0;
                        for (int k = 0; k < 5 && k + j < 10 && k + i < 10; k++) {
                            if (arr[i + k][j + k] != 'X') {
                                break;
                            }
                            c++;
                        }
                        f |= c == 5;
                        c = 0;
                        for (int k = 0; k < 5 && j - k >= 0 && i + k < 10; k++) {
                            if (arr[i + k][j - k] != 'X') {
                                break;
                            }
                            c++;
                        }
                        f |= c == 5;
                        c = 0;
                        for (int k = 0; k < 5 && i - k >= 0 && j - k > 10; k++) {
                            if (arr[i - k][j - k] != 'X') {
                                break;
                            }
                            c++;
                        }
                        f |= c == 5;
                        c = 0;
                        for (int k = 0; k < 5 && i - k < 10 && j + k > 10; k++) {
                            if (arr[i - k][j + k] != 'X') {
                                break;
                            }
                            c++;
                        }
                        f |= c == 5;
                    }
                }
            return f;
        }

        private boolean check() {
            boolean f = false;
            for (int i = 0; i < 10; i++)
                for (int j = 0; j < 10; j++) {
                    if (arr[i][j] == 'X') {
                        int c = 0;
                        for (int k = 0; k < 5 && k + j < 10; k++) {
                            if (arr[i][j + k] != 'X') {
                                break;
                            }
                            c++;
                        }
                        f |= c == 5;
                        c = 0;
                        for (int k = 0; k < 5 && j - k >= 0; k++) {
                            if (arr[i][j - k] != 'X') {
                                break;
                            }
                            c++;
                        }
                        f |= c == 5;
                        c = 0;
                        for (int k = 0; k < 5 && i - k >= 0; k++) {
                            if (arr[i - k][j] != 'X') {
                                break;
                            }
                            c++;
                        }
                        f |= c == 5;
                        c = 0;
                        for (int k = 0; k < 5 && i + k < 10; k++) {
                            if (arr[i + k][j] != 'X') {
                                break;
                            }
                            c++;
                        }
                        f |= c == 5;
                    }
                }
            return f;
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{
	public static void main(String args[]){
		InputReader scan = new InputReader();
		char[][] c = new char[10][10];
		for(int i = 0; i < 10; i++){
			String str = scan.next();
			for(int j = 0; j < 10; j++)
				c[i][j] = str.charAt(j);
		}
		for(int x = 0; x < 10; x++){
			for(int y = 0; y < 10; y++){
				if(c[x][y] == '.'){
					int counter = 0;
					for(int i = x+1, j = y; i < 10 && c[i][j] == 'X'; i++) counter++;
					for(int i = x-1, j = y; i >= 0 && c[i][j] == 'X'; i--) counter++;
					if(counter >= 4){
						System.out.println("YES");
						return;
					}

					counter = 0;
					for(int i = x, j = y+1; j < 10 && c[i][j] == 'X'; j++) counter++;
					for(int i = x, j = y-1; j >= 0 && c[i][j] == 'X'; j--) counter++;
					if(counter >= 4){
						System.out.println("YES");
						return;
					}

					counter = 0;
					for(int i = x+1, j = y+1; i < 10 && j < 10 && c[i][j] == 'X'; i++, j++) counter++;
					for(int i = x-1, j = y-1; i >= 0 && j >= 0 && c[i][j] == 'X'; i--, j--) counter++;
					if(counter >= 4){
						System.out.println("YES");
						return;
					}

					counter = 0;
					for(int i = x+1, j = y-1; i < 10 && j >= 0 && c[i][j] == 'X'; i++, j--) counter++;
					for(int i = x-1, j = y+1; i >= 0 && j < 10 && c[i][j] == 'X'; i--, j++) counter++;
					if(counter >= 4){
						System.out.println("YES");
						return;
					}
				}
			}
		}
		System.out.println("NO");
	}

	//Custom Scanner

	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader() {
            reader = new BufferedReader(new InputStreamReader(System.in));
            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());
        }

    }

}

import java.util.Scanner;

public class Task2_4 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        byte[][] arr = new byte[10][10];
        boolean needToWork = true;
        for (int i = 0; i < 10; i++) {
            String s = in.nextLine();
            if (needToWork) {
                if (s.contains(".XXXX") || s.contains("X.XXX") || (s.contains("XX.XX")) || (s.contains("XXX.X")) || (s.contains("XXXX.")))
                    needToWork = false;
                else {
                    for (int j = 0; j < 10; j++) {
                        if (s.charAt(j) == 'X') arr[i][j] = 1;
                        else if (s.charAt(j) == 'O') arr[i][j] = 0;
                        else arr[i][j] = 2;
                    }
                    if (i > 3) {
                        for (int j = 0; (j < 10) && needToWork; j++){
                            if((arr[i - 4][j] == 1) && (arr[i - 3][j] == 1) && (arr[i - 2][j] == 1) && (arr[i - 1][j] == 1) && ((arr[i][j] == 1) || (arr[i][j] == 2))) needToWork = false;
                            else if((arr[i - 4][j] == 1) && (arr[i - 3][j] == 1) && (arr[i - 2][j] == 1) && (arr[i][j] == 1) && ((arr[i - 1][j] == 1) || (arr[i - 1][j] == 2))) needToWork = false;
                            else if((arr[i - 4][j] == 1) && (arr[i - 3][j] == 1) && (arr[i - 1][j] == 1) && (arr[i][j] == 1) && ((arr[i - 2][j] == 1) || (arr[i - 2][j] == 2))) needToWork = false;
                            else if((arr[i - 4][j] == 1) && (arr[i - 1][j] == 1) && (arr[i - 2][j] == 1) && (arr[i][j] == 1) && ((arr[i - 3][j] == 1) || (arr[i - 3][j] == 2))) needToWork = false;
                            else if((arr[i - 1][j] == 1) && (arr[i - 3][j] == 1) && (arr[i - 2][j] == 1) && (arr[i][j] == 1) && ((arr[i - 4][j] == 1) || (arr[i - 4][j] == 2))) needToWork = false;
                        }
                        for (int j = 4; (j < 10) && needToWork; j++) {
                            if ((arr[i - 4][j - 4] == 1) && (arr[i - 3][j - 3] == 1) && (arr[i - 2][j - 2] == 1) && (arr[i - 1][j - 1] == 1) && ((arr[i][j] == 1) || (arr[i][j] == 2)))
                                needToWork = false;
                            else if ((arr[i - 4][j - 4] == 1) && (arr[i - 3][j - 3] == 1) && (arr[i - 2][j - 2] == 1) && (arr[i][j] == 1) && ((arr[i - 1][j - 1] == 1) || (arr[i - 1][j - 1] == 2)))
                                needToWork = false;
                            else if ((arr[i - 4][j - 4] == 1) && (arr[i - 3][j - 3] == 1) && (arr[i - 1][j - 1] == 1) && (arr[i][j] == 1) && ((arr[i - 2][j - 2] == 1) || (arr[i - 2][j - 2] == 2)))
                                needToWork = false;
                            else if ((arr[i - 4][j - 4] == 1) && (arr[i - 1][j - 1] == 1) && (arr[i - 2][j - 2] == 1) && (arr[i][j] == 1) && ((arr[i - 3][j - 3] == 1) || (arr[i - 3][j - 3] == 2)))
                                needToWork = false;
                            else if ((arr[i - 1][j - 1] == 1) && (arr[i - 3][j - 3] == 1) && (arr[i - 2][j - 2] == 1) && (arr[i][j] == 1) && ((arr[i - 4][j - 4] == 1) || (arr[i - 4][j - 4] == 2)))
                                needToWork = false;
                        }
                        for (int j = 5; (j >= 0) && needToWork; j--) {
                            if ((arr[i - 4][j + 4] == 1) && (arr[i - 3][j + 3] == 1) && (arr[i - 2][j + 2] == 1) && (arr[i - 1][j + 1] == 1) && ((arr[i][j] == 1) || (arr[i][j] == 2)))
                                needToWork = false;
                            else if ((arr[i - 4][j + 4] == 1) && (arr[i - 3][j + 3] == 1) && (arr[i - 2][j + 2] == 1) && (arr[i][j] == 1) && ((arr[i - 1][j + 1] == 1) || (arr[i - 1][j + 1] == 2)))
                                needToWork = false;
                            else if ((arr[i - 4][j + 4] == 1) && (arr[i - 3][j + 3] == 1) && (arr[i - 1][j + 1] == 1) && (arr[i][j] == 1) && ((arr[i - 2][j + 2] == 1) || (arr[i - 2][j + 2] == 2)))
                                needToWork = false;
                            else if ((arr[i - 4][j + 4] == 1) && (arr[i - 1][j + 1] == 1) && (arr[i - 2][j + 2] == 1) && (arr[i][j] == 1) && ((arr[i - 3][j + 3] == 1) || (arr[i - 3][j + 3] == 2)))
                                needToWork = false;
                            else if ((arr[i - 1][j + 1] == 1) && (arr[i - 3][j + 3] == 1) && (arr[i - 2][j + 2] == 1) && (arr[i][j] == 1) && ((arr[i - 4][j + 4] == 1) || (arr[i - 4][j + 4] == 2)))
                                needToWork = false;
                        }
                    }
                }
            }
        }
        if (needToWork) System.out.println("NO");
        else System.out.println("YES");
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class D{

	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

	static class Pair
	{
		int p;
		int q;
		Pair(int p,int q)
		{
			this.p = p;
			this.q = q;
		}
	}

	public static void main(String[] args)
	{
		OutputStream outputStream = System.out;
        FastReader sc = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);

        char mat[][] = new char[10][10];

        for(int i = 0; i < 10; i++)
        {

        	mat[i] = sc.nextLine().toCharArray();

        }

        for(int i = 0; i < 10; i++)
        {
        	for(int j = 0; j < 10; j++)
        	{

        		if(mat[i][j] == 'X')
        		{
        			//right
        			//System.out.println("in");
        			boolean done = false;
        			for(int k = 1; k < 5 && k+j < 10; k++)
        			{
        				//out.println("down");
        				if(mat[i][j+k] == 'O') break;
        				if(mat[i][j+k] == '.' && done == false)
        				{
        					done = true;
        				}
        				else if(mat[i][j+k] == '.' && done == true)
        				{
        					break;
        				}
        				if(k == 4)
        				{
        					out.println("YES");
        					out.close();
        					return;
        				}

        			}

        			//down
        			done = false;
        			for(int k = 1; k < 5 && k+i < 10; k++)
        			{
        				//out.println("right");
        				if(mat[i+k][j] == 'O') break;
        				if(mat[i+k][j] == '.' && done == false)
        				{
        					done = true;
        				}
        				else if(mat[i+k][j] == '.' && done == true)
        				{
        					break;
        				}
        				if(k == 4)
        					{
        					out.println("YES");
        					out.close();
        					return;
        					}
        			}

        			//diag left
        			done = false;
        			for(int k = 1; k < 5 && j-k >=0 && k+i < 10; k++)
        			{
        				//out.println("in diag left");
        				if(mat[i+k][j-k] == 'O') break;
        				if(mat[i+k][j-k] == '.' && done == false)
        					{
        					done = true;
        					}
        				else if(mat[i+k][j-k] == '.' && done == true) break;
        				if(k == 4)
        				{
        					out.println("YES");
        					out.close();
        					return;
        				}

        			}
        			//diag right
        			done = false;
        			for(int k = 1; k < 5 && i+k < 10 && j+k < 10; k++)
        			{
        				//out.println("in diag right");
        				if(mat[i+k][j+k] == 'O') break;
        				if(mat[i+k][j+k] == '.' && done == false)
        				{
        					done = true;
        				}
        				else if(mat[i+k][j+k] == '.' && done == true) break;
        				if(k == 4)
        				{
        					out.println("YES");
        					out.close();
        					return;
        				}

        			}
        			done = false;
        			for(int k = 1; k < 5 && i-k >= 0 && j-k >= 0; k++)
        			{
        				//out.println("in diag right");
        				if(mat[i-k][j-k] == 'O') break;
        				if(mat[i-k][j-k] == '.' && done == false)
        				{
        					done = true;
        				}
        				else if(mat[i-k][j-k] == '.' && done == true) break;
        				if(k == 4)
        				{
        					out.println("YES");
        					out.close();
        					return;
        				}

        			}
        			done = false;
        			for(int k = 1; k < 5 && i-k >= 0 && j+k < 10; k++)
        			{
        				//out.println("in diag right");
        				if(mat[i-k][j+k] == 'O') break;
        				if(mat[i-k][j+k] == '.' && done == false)
        				{
        					done = true;
        				}
        				else if(mat[i-k][j+k] == '.' && done == true) break;
        				if(k == 4)
        				{
        					out.println("YES");
        					out.close();
        					return;
        				}

        			}
        			done = false;
        			for(int k = 1; k < 5  && j-k >= 0; k++)
        			{
        				//out.println("in diag right");
        				if(mat[i][j-k] == 'O') break;
        				if(mat[i][j-k] == '.' && done == false)
        				{
        					done = true;
        				}
        				else if(mat[i][j-k] == '.' && done == true) break;
        				if(k == 4)
        				{
        					out.println("YES");
        					out.close();
        					return;
        				}

        			}
        			done = false;
        			for(int k = 1; k < 5 && i-k >= 0; k++)
        			{

        				if(mat[i-k][j] == 'O') break;
        				if(mat[i-k][j] == '.' && done == false)
        				{
        					done = true;
        				}
        				else if(mat[i-k][j] == '.' && done == true) break;
        				if(k == 4)
        				{
        					out.println("YES");
        					out.close();
        					return;
        				}

        			}
        		}
        	}
        }
        out.println("NO");

        out.close();
	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Abhilash Mandaliya
 */
public class Main {
    public static void main (String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader( inputStream );
        PrintWriter out = new PrintWriter( outputStream );
        TaskB solver = new TaskB();
        solver.solve( 1, in, out );
        out.close();
    }

    static class TaskB {
        public void solve (int testNumber, InputReader in, PrintWriter out) {
            char[][] board = new char[10][10];
            int cross = 0, zero = 0;
            int x = - 1, y = - 1;
            String yes = "YES", no = "NO";
            for ( int i = 0; i < 10; i++ ) {
                board[i] = in.readString().toCharArray();
                for ( int j = 0; j < 10; j++ ) {
                    if ( board[i][j] == 'X' ) {
                        cross++;
                        if ( x == - 1 ) {
                            x = i;
                            y = j;
                        }
                    }
                    else if ( board[i][j] == 'O' )
                        zero++;
                }
            }
            if ( cross < 4 ) {
                out.println( no );
                return;
            }
            else {
                for ( int i = 0; i < 10; i++ ) {
                    for ( int j = 0; j < 10; j++ ) {
                        if ( board[i][j] == 'X' && ( checkDown( board, i, j ) || checkLeft( board, i, j ) || checkLeftDown( board, i, j ) || checkLeftUp( board, i, j ) || checkRight( board, i, j ) || checkRightDown( board, i, j ) || checkRightUp( board, i, j ) || checkUp( board, i, j ) ) ) {
                            out.println( yes );
                            return;
                        }
                    }
                }
            }
            out.println( no );
        }

        public static boolean checkLeft (char[][] board, int row, int col) {
            if ( col - 4 < 0 )
                return false;
            int cnt = 0;
            for ( int i = col; i >= col - 4; i-- ) {
                if ( board[row][i] == 'X' )
                    cnt++;
                else if ( board[row][i] != '.' )
                    return false;
            }
            return cnt == 4;
        }

        public static boolean checkRight (char[][] board, int row, int col) {
            if ( col + 4 > 9 )
                return false;
            int cnt = 0;
            for ( int i = col; i <= col + 4; i++ ) {
                if ( board[row][i] == 'X' )
                    cnt++;
                else if ( board[row][i] != '.' )
                    return false;
            }
            return cnt == 4;
        }

        public static boolean checkUp (char[][] board, int row, int col) {
            if ( row - 4 < 0 )
                return false;
            int cnt = 0;
            for ( int i = row; i >= row - 4; i-- ) {
                if ( board[i][col] == 'X' )
                    cnt++;
                else if ( board[i][col] != '.' )
                    return false;
            }
            return cnt == 4;
        }

        public static boolean checkDown (char[][] board, int row, int col) {
            if ( row + 4 > 9 )
                return false;
            int cnt = 0;
            for ( int i = row; i <= row + 4; i++ ) {
                if ( board[i][col] == 'X' )
                    cnt++;
                else if ( board[i][col] != '.' )
                    return false;
            }
            return cnt == 4;
        }

        public static boolean checkLeftUp (char[][] board, int row, int col) {
            if ( row - 4 < 0 || col - 4 < 0 )
                return false;
            int cnt = 0;
            for ( int i = row; i >= row - 4; i--, col-- ) {
                if ( board[i][col] == 'X' )
                    cnt++;
                else if ( board[i][col] != '.' )
                    return false;
            }
            return cnt == 4;
        }

        public static boolean checkRightUp (char[][] board, int row, int col) {
            if ( row - 4 < 0 || col + 4 > 9 )
                return false;
            int cnt = 0;
            for ( int i = row; i >= row - 4; i--, col++ ) {
                if ( board[i][col] == 'X' )
                    cnt++;
                else if ( board[i][col] != '.' )
                    return false;
            }
            return cnt == 4;
        }

        public static boolean checkLeftDown (char[][] board, int row, int col) {
            if ( row + 4 > 9 || col - 4 < 0 )
                return false;
            int cnt = 0;
            for ( int i = row; i <= row + 4; i++, col-- ) {
                if ( board[i][col] == 'X' )
                    cnt++;
                else if ( board[i][col] != '.' )
                    return false;
            }
            return cnt == 4;
        }

        public static boolean checkRightDown (char[][] board, int row, int col) {
            if ( row + 4 > 9 || col + 4 > 9 )
                return false;
            int cnt = 0;
            for ( int i = row; i <= row + 4; i++, col++ ) {
                if ( board[i][col] == 'X' )
                    cnt++;
                else if ( board[i][col] != '.' )
                    return false;
            }
            return cnt == 4;
        }

    }

    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar;
        private int 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 String readString () {
            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 boolean isSpaceChar (int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == - 1;
        }

    }
}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main {

    static Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

    public static void main(String[] args) {
        String[] s = new String[10];
        for (int i = 0; i < 10; i++) {
            s[i] = input.next();
        }
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j <= 5; j++) {
                int x = 0, p = 0;
                for (int k = 0; k < 5; k++) {
                    if (s[i].charAt(j + k) == 'X') {
                        x++;
                    }
                    if (s[i].charAt(j + k) == '.') {
                        p++;
                    }
                }
                if (x == 4 && p == 1) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        for (int i = 0; i <= 5; i++) {
            for (int j = 0; j < 10; j++) {
                int x = 0, p = 0;
                for (int k = 0; k < 5; k++) {
                    if (s[i + k].charAt(j) == 'X') {
                        x++;
                    }
                    if (s[i + k].charAt(j) == '.') {
                        p++;
                    }
                }
                if (x == 4 && p == 1) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        for (int i = 0; i <= 5; i++) {
            for (int j = 0; j <= 5; j++) {
                int x = 0, p = 0;
                for (int k = 0; k < 5; k++) {
                    if (s[i + k].charAt(j + k) == 'X') {
                        x++;
                    }
                    if (s[i + k].charAt(j + k) == '.') {
                        p++;
                    }
                }
                if (x == 4 && p == 1) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        for (int i = 0; i <= 5; i++) {
            for (int j = 4; j < 10; j++) {
                int x = 0, p = 0;
                for (int k = 0; k < 5; k++) {
                    if (s[i + k].charAt(j - k) == 'X') {
                        x++;
                    }
                    if (s[i + k].charAt(j - k) == '.') {
                        p++;
                    }
                }
                if (x == 4 && p == 1) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Mayank
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String[] a = new String[10];
            for (int i = 0; i < 10; i++)
                a[i] = in.next();
            int[] row = new int[10];
            int[] col = new int[10];
            boolean f = true;
            for (int i = 0; i < 10 && f; i++) {
                for (int j = 0; j < 10 && f; j++) {
                    if (a[i].charAt(j) == '.' && f) {
                        if (fun(a, i, j)) {
                            out.println("YES");
                            f = false;
                        }
                    }
                }
            }
            if (f)
                out.println("NO");
        }

        private boolean fun(String[] a, int i, int j) {
            int row = 0;
            int col = 0;
            int ldia = 0;
            int rdia = 0;
            int taken = 0;
            for (int k = 0; k < 10; k++) {
                if (a[k].charAt(j) == 'X' || (k == i)) {
                    taken += 1;
                } else {
                    row = Integer.max(row, taken);
                    taken = 0;
                }
            }
            row = Integer.max(row, taken);
            taken = 0;
            for (int k = 0; k < 10; k++) {
                if (a[i].charAt(k) == 'X' || (k == j)) {
                    taken += 1;
                } else {
                    col = Integer.max(col, taken);
                    taken = 0;
                }
            }
            col = Integer.max(col, taken);
            taken = 0;
            int ti = i - Integer.min(i, j), tj = j - Integer.min(i, j);
            while (ti < 10 && tj < 10) {
                if (a[ti].charAt(tj) == 'X' || (ti == i && tj == j)) {
                    taken += 1;
                } else {
                    ldia = Integer.max(ldia, taken);
                    taken = 0;
                }
                ti += 1;
                tj += 1;
            }
            ldia = Integer.max(ldia, taken);
            taken = 0;
            for (int k = 0; k < 10; k++) {
                for (int o = 0; o < 10; o++) {
                    if (k + o == i + j) {
                        if (a[k].charAt(o) == 'X' || (k == i && o == j)) {
                            taken += 1;
                        } else {
                            rdia = Integer.max(rdia, taken);
                            taken = 0;
                        }
                    }
                }
            }
            rdia = Integer.max(rdia, taken);
            if ((row >= 5) || (col >= 5) || (ldia >= 5) || (rdia >= 5)) {
                return true;
            } else {
                return false;
            }
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author shanky_ty
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            char[][] x = new char[10][10];
            for (int i = 0; i < 10; i++) {
                String l = in.next();
                for (int j = 0; j < 10; j++) {
                    x[i][j] = l.charAt(j);
                }
            }
            for (int i = 0; i < 10; i++) {
                for (int j = 0; j < 10; j++) {
                    if (checkH(x, i, j) || checkD(x, i, j) || checkV(x, i, j) || checkOD(x, i, j)) {
                        out.write("YES");
                        return;
                    }
                }
            }
            out.write("NO");
        }

        boolean checkH(char[][] x, int i, int j) {
            if (j > 5) return false;
            int e = 0;
            int xc = 0;
            for (int k = j; k < j + 5; k++) {
                if (x[i][k] == 'X') {
                    xc++;
                } else if (x[i][k] == '.') {
                    e++;
                } else {
                    return false;
                }
            }
            return xc == 4 && e == 1;
        }

        boolean checkV(char[][] x, int i, int j) {
            if (i > 5) return false;
            int e = 0;
            int xc = 0;
            for (int k = i; k < i + 5; k++) {
                if (x[k][j] == 'X') {
                    xc++;
                } else if (x[k][j] == '.') {
                    e++;
                } else {
                    return false;
                }
            }
            return xc == 4 && e == 1;
        }

        boolean checkD(char[][] x, int i, int j) {
            if (i > 5 || j > 5) return false;
            int e = 0;
            int xc = 0;
            for (int k = 0; k < 5; k++) {
                if (x[i + k][j + k] == 'X') {
                    xc++;
                } else if (x[i + k][j + k] == '.') {
                    e++;
                } else {
                    return false;
                }
            }
            return xc == 4 && e == 1;
        }

        boolean checkOD(char[][] x, int i, int j) {
            if (i < 4 || j > 5) return false;
            int e = 0;
            int xc = 0;
            for (int k = 0; k < 5; k++) {
                if (x[i - k][j + k] == 'X') {
                    xc++;
                } else if (x[i - k][j + k] == '.') {
                    e++;
                } else {
                    return false;
                }
            }
            return xc == 4 && e == 1;
        }

    }
}

import java.util.Scanner;

public class FiveinARow {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner input = new Scanner(System.in);
		char[][] s = new char[10][10];
		for(int i=0; i<10;i++){
			s[i] = input.next().toCharArray();

		}
		//System.out.println(check1(s,0,4));
		for(int i=0; i<10;i++){
			for(int j=0; j<10;j++){
				if( i>=4){
					if(checkrow( s,  i,j)){
						System.out.println("YES");
						//System.out.println(i+" "+j);
						return;
					}
				}
				if(j>=4){
					if(checkcolumn(s,i,j)){
						System.out.println("YES");
						//System.out.println(i+" "+j+"d");
						return;
					}
				}
				if(i>=4 && j>=4){
					if(check(s,i,j)){
						System.out.println("YES");
						//System.out.println(i+" "+j+"s");
						return;
					}
				}
				if(i<=5 && j>=4){
					if(check1(s,i,j)){
						System.out.println("YES");
						return;
					}
				}
			}
		}
		System.out.println("NO");

	}

	private static boolean checkrow(char[][] s, int i, int j){
		int crosses = 0;
		int dots=0;
		for(int tmp=i-4; tmp<=i;tmp++){
			if(s[tmp][j]=='X')crosses++;
			else if(s[tmp][j]=='.')dots++;
		}
		if((dots==0 && crosses==5) ||(dots==1 && crosses==4) )return true;
		else
			return false;
	}
	private static boolean checkcolumn(char[][] s, int i,int j){
		int crosses=0;
		int dots=0;
		for(int tmp = j-4;tmp<=j;tmp++){
			if(s[i][tmp]=='X')crosses++;
			else if(s[i][tmp]=='.')dots++;
		}
		if((dots==0 && crosses==5) ||(dots==1 && crosses==4) ){
			//System.out.println(dots+" "+crosses);
			return true;
		}
		else
			return false;
	}

	private static boolean check(char[][] s, int i, int j){
		int tmp2 = i-4;
		int crosses=0;
		int dots=0;
		for(int tmp=j-4; tmp<=j;tmp++){
			if(s[tmp2][tmp]=='X')crosses++;
			else
				if(s[tmp2][tmp]=='.')dots++;
		   tmp2++;
		}
		if((dots==0 && crosses==5) ||(dots==1 && crosses==4) )return true;
		else
			return false;

	}

	private static boolean check1(char[][] s,int i, int j){
		int tmp2 = j-4;
		int crosses=0;
		int dots=0;
		for(int tmp=i+4;tmp>=i;tmp--){
			if(s[tmp][tmp2]=='X')crosses++;
			else
				if(s[tmp][tmp2]=='.')dots++;
			tmp2++;
		}
		if((dots==0 && crosses==5) ||(dots==1 && crosses==4) )return true;
		else
			return false;
	}

}

import java.util.Scanner;

/**
 *
 * 作者：张宇翔
 * 创建日期：2017年7月16日 下午11:04:25
 * 描述：
 */
public class Main {

	private static final int Max = (int) (1e3 + 10);
	private static String []s;
	private static char [][]a;
	public static void main(String[] args) {
		InitData();
		GetAns();
	}
	private static void InitData() {
		Scanner cin = new Scanner(System.in);
		s=new String[Max];
		a=new char[Max][Max];
		for(int i=0;i<10;i++){
			s[i]=cin.next();
			a[i]=s[i].toCharArray();
		}
	};

	private static void GetAns() {
		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				if(a[i][j]=='.'){
					a[i][j]='X';
					if(judge()){
						System.out.println("YES");
						return;
					}
					a[i][j]='.';
				}
			}
		}
		System.out.println("NO");
		return;
	};

	private static boolean judge(){
		for(int i=0;i<10;i++){//判断横
			for(int j=0;j<=10-5;j++){
				if(a[i][j]=='X'&&a[i][j+1]=='X'&&a[i][j+2]=='X'
						&&a[i][j+3]=='X'&&a[i][j+4]=='X'){
					return true;
				}
			}
		}
		for(int i=0;i<10;i++){//判断竖
			for(int j=0;j<=10-5;j++){
				if(a[j][i]=='X'&&a[j+1][i]=='X'&&a[j+2][i]=='X'
						&&a[j+3][i]=='X'&&a[j+4][i]=='X'){
					return true;
				}
			}
		}

		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				int cnt=0;
				if(Check(i, j)){
					cnt++;
				}
				if(Check(i+1, j+1)){
					cnt++;
				}
				if(Check(i+2, j+2)){
					cnt++;
				}
				if(Check(i+3, j+3)){
					cnt++;
				}
				if(Check(i+4, j+4)){
					cnt++;
				}
				if(cnt==5){
					return true;
				}
			}
		}

		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				int cnt=0;
				if(Check(i, j)){
					cnt++;
				}
				if(Check(i+1, j-1)){
					cnt++;
				}
				if(Check(i+2, j-2)){
					cnt++;
				}
				if(Check(i+3, j-3)){
					cnt++;
				}
				if(Check(i+4, j-4)){
					cnt++;
				}
				if(cnt==5){
					return true;
				}
			}
		}
		return false;
	}

	private static boolean Check(int x,int y){
		if(x>=0&&x<10&&y>=0&&y<10&&a[x][y]=='X'){
			return true;
		}
		return false;
	}
}

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");
    }
}

import java.util.*;

public class test
{
    private static Scanner sc = new Scanner(System.in);
	private static String abc[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};

	//X 1
	//O 2
	//. 3
	private static int[][] data = new int[10][10];

	private static Boolean f(int x, int y)
	{
		for(int left = x-4;left<=x;left++)
		{
			int sum = 0;
			for(int i=0;i<5;i++)
			{
				if(left+i>=0 && left+i<10)
				{
					sum+=data[left+i][y];
				}
			}
			if(sum==40)return true;
		}

		for(int left = y-4;left<=y;left++)
		{
			int sum = 0;
			for(int i=0;i<5;i++)
			{
				if(left+i>=0 && left+i<10)
				{
					sum+=data[x][left+i];
				}
			}
			if(sum==40)return true;
		}

		for(int left = -4;left<=0;left++)
		{
			int sum = 0;
			for(int i=0;i<5;i++)
			{
				if(left+x+i>=0 && left+x+i<10 && left+y+i>=0 && left+y+i<10)
				{
					sum+=data[left+x+i][left+y+i];
				}
			}
			if(sum==40)return true;
		}
		for(int left = -4;left<=0;left++)
		{
			int sum = 0;
			for(int i=0;i<5;i++)
			{
				if(left+x+i>=0 && left+x+i<10 && -left+y-i>=0 && -left+y-i<10)
				{
					sum+=data[left+x+i][-left+y-i];
				}
			}
			if(sum==40)return true;
		}
		return false;
	}
	public static void main(String[] args)
    {
		for(int i=0;i<10;i++)
		{
			String s = sc.next();
			for(int j = 0;j<10;j++)
			{
				if(s.charAt(j) == 'X')
				{
					data[i][j] = 10;
				}
				if(s.charAt(j) == 'O')
				{
					data[i][j] = 2;
				}
				if(s.charAt(j) == '.')
				{
					data[i][j] = 0;
				}
			}
		}

		for(int i=0;i<10;i++)
		{
			for(int j = 0;j<10;j++)
			{
				if(data[i][j] == 0 && f(i,j))
				{
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");

	}
}

/*
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

5  10
6  7
7  9
8  9
9  20
10 18
11 46
12 67
13 69
14 68
15 77
*/

// practice with kaiboy
import java.io.*;
import java.util.*;

public class CF825B extends PrintWriter {
	CF825B() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF825B o = new CF825B(); o.main(); o.flush();
	}

	boolean check(byte a, byte b, byte c, byte d, byte e) {
		if (a == 'O' || b == 'O' || c == 'O' || d == 'O' || e == 'O')
			return false;
		int k = 0;
		if (a == '.')
			k++;
		if (b == '.')
			k++;
		if (c == '.')
			k++;
		if (d == '.')
			k++;
		if (e == '.')
			k++;
		return k == 1;
	}
	void main() {
		byte[][] cc = new byte[10][];
		for (int i = 0; i < 10; i++)
			cc[i] = sc.next().getBytes();
		for (int i = 0; i < 10; i++)
			for (int j = 2; j < 8; j++)
				if (check(cc[i][j - 2], cc[i][j - 1], cc[i][j], cc[i][j + 1], cc[i][j + 2])) {
					println("YES");
					return;
				}
		for (int i = 2; i < 8; i++)
			for (int j = 0; j < 10; j++)
				if (check(cc[i - 2][j], cc[i - 1][j], cc[i][j], cc[i + 1][j], cc[i + 2][j])) {
					println("YES");
					return;
				}
		for (int i = 2; i < 8; i++)
			for (int j = 2; j < 8; j++)
				if (check(cc[i - 2][j - 2], cc[i - 1][j - 1], cc[i][j], cc[i + 1][j + 1], cc[i + 2][j + 2]) || check(cc[i - 2][j + 2], cc[i - 1][j + 1], cc[i][j], cc[i + 1][j - 1], cc[i + 2][j - 2])) {
					println("YES");
					return;
				}
		println("NO");
	}
}

/////////////package random_practiceQuestions;

import java.util.Scanner;

public class B825 {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner s = new Scanner(System.in);
        String[] list=new String[10];
        for (int i=0;i<10;i++){
            list[i]=s.nextLine();
        }
        int r;
        int c;
        int ans=0;
        for (int i=0;i<10;i++){
            for (int j=0;j<10;j++){
                if (list[i].charAt(j)=='.'){
                    r=i;
                    int sum=0;
                    c=j-1;
                    while (check(r,c) && list[r].charAt(c)=='X'){
                        sum++;
                        c--;
                    }
                    c=j+1;
                    while (check(r,c) && list[r].charAt(c)=='X'){
                        sum++;
                        c++;
                    }
                    ans=Math.max(ans,sum);
                    c=j;
                    r=i-1;
                    sum=0;
                    while (check(r,c) && list[r].charAt(c)=='X'){
                        sum++;
                        r--;
                    }
                    r=i+1;
                    while (check(r,c) && list[r].charAt(c)=='X'){
                        sum++;
                        r++;
                    }
                    ans=Math.max(ans,sum);

                    r=i-1;
                    c=j-1;
                    sum=0;
                    while (check(r,c) && list[r].charAt(c)=='X'){
                        sum++;
                        r--;
                        c--;
                    }
                    r=i+1;
                    c=j+1;
                    while (check(r,c) && list[r].charAt(c)=='X'){
                        sum++;
                        r++;
                        c++;
                    }
                    ans=Math.max(ans,sum);
                    sum=0;
                    r=i-1;
                    c=j+1;
                    while (check(r,c) && list[r].charAt(c)=='X'){
                        sum++;
                        r--;
                        c++;
                    }
                    r=i+1;
                    c=j-1;
                    while (check(r,c) && list[r].charAt(c)=='X'){
                        sum++;
                        r++;
                        c--;
                    }
                    ans=Math.max(sum,ans);

                }
            }
        }
        ans++;
        if (ans>=5){
            System.out.println("YES");
        }
        else{
            System.out.println("NO");
        }
    }
    public static boolean check(int a, int b){
        return (a>=0 && b>=0 && a<10 && b<10);
    }
}

//package kattis.Codeforces;

import java.io.*;
import java.util.*;

public class B425 {
	public static char[][] map = new char[10][];
	public static void main(String[] args) throws IOException {
		IO io = new IO(System.in);

		for(int i = 0; i < 10; i++) {
			map[i] = io.next().toCharArray();
		}
		boolean found = false;
		for(int i = 0; i < 6; i++) {
			for(int j = 0; j < 6; j++) {
				found = found || checkdia(i,j);
			}
		}
		for(int i = 0; i < 6; i++) {
			for(int j = 0; j < 10; j++) {
				found = found || checkrow(i,j);
			}
		}
		for(int i = 0; i < 10; i++) {
			for(int j = 0; j < 6; j++) {
				found = found || checkcol(i,j);
			}
		}
		for(int i = 4; i < 10; i++) {
			for(int j = 0; j < 6; j++) {
				found = found || checkdia1(i,j);
			}
		}
		io.println((found?"YES":"NO"));
		io.close();
	}
	public static boolean checkrow(int x, int y) {
		int count = 0;
		for(int i = 0; i < 5; i++) {
			if(map[x+i][y] == 'O') {
				return false;
			} else if(map[x+i][y] == '.') {
				count++;
			}
		}
		return count == 1;
	}
	public static boolean checkcol(int x, int y) {
		int count = 0;
		for(int i = 0; i < 5; i++) {
			if(map[x][y+i] == 'O') {
				return false;
			} else if(map[x][y+i] == '.') {
				count++;
			}
		}
		return count == 1;
	}
	public static boolean checkdia(int x, int y) {
		int count = 0;
		for(int i = 0; i < 5; i++) {
			if(map[x+i][y+i] == 'O') {
				return false;
			} else if(map[x+i][y+i] == '.') {
				count++;
			}
		}
		return count == 1;
	}
	public static boolean checkdia1(int x, int y) {
		int count = 0;
		for(int i = 0; i < 5; i++) {
			if(map[x-i][y+i] == 'O') {
				return false;
			} else if(map[x-i][y+i] == '.') {
				count++;
			}
		}
		return count == 1;
	}

	static class IO extends PrintWriter {
		static BufferedReader r;
		static StringTokenizer t;

		public IO(InputStream i) {
			super(new BufferedOutputStream(System.out));
			r = new BufferedReader(new InputStreamReader(i));
			t = new StringTokenizer("");
		}

		public String next() throws IOException {
			while (!t.hasMoreTokens()) {
				t = new StringTokenizer(r.readLine());
			}
			return t.nextToken();
		}

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

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

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

    import java.util.Scanner;

    public class FiveInARow {

        public static void main(String[] args) {
            // TODO code application logic here
            Scanner in = new Scanner(System.in);
            char m[][]= new char[10][10];
            for(int i=0;i<10;i++){
                String str=in.next();
                m[i]=str.toCharArray();
            }

            boolean ip=false;
            String output="NO";
            for(int i=0;i<10 && !ip;i++){
                for(int j=0;j<10 && !ip;j++){
                    if(m[i][j]=='X' || m[i][j]=='.'){
                        if(j<6 && i<6 && !ip){
                            int c=0;
                            int ef=0;
                            for(int k=0;k<5;k++){
                                if(m[i+k][j+k]=='O') break;
                                else if(m[i+k][j+k]=='X') c++;
                                else if(m[i+k][j+k]=='.') ef++;
                            }
                            if(c==4 && ef==1) {ip=true;output="YES"; break;}
                        }
                        if(j>3 && i<6 && !ip){
                            int c=0;
                            int ef=0;
                            for(int k=0;k<5;k++){
                                if(m[i+k][j-k]=='O') break;
                                else if(m[i+k][j-k]=='X') c++;
                                else if(m[i+k][j-k]=='.') ef++;
                            }
                            if(c==4 && ef==1) {ip=true;output="YES";break;}
                        }
                        if(j<6 && !ip){
                            int c=0;
                            int ef=0;
                            for(int k=j;k<j+5;k++){
                                if(m[i][k]=='O') break;
                                else if(m[i][k]=='X') c++;
                                else if(m[i][k]=='.') ef++;
                            }
                            if(c==4 && ef==1) {ip=true;output="YES";break;}
                        }if(i<6 && !ip){
                            int c=0;
                            int ef=0;
                            for(int k=i;k<i+5;k++){
                                if(m[k][j]=='O') break;
                                else if(m[k][j]=='X') c++;
                                else if(m[k][j]=='.') ef++;
                            }
                            if(c==4 && ef==1) {ip=true;output="YES";break;}
                        }
                    }
                }
            }
            System.out.println(output);
        }

    }

import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
	static int t,m,mod=998244353,maxn=1000000,q,n,k,cnt=2;
    static long INF=(long)1e18;

    void solve(PrintWriter out, Reader in) throws IOException{
        int[][] arr = new int[10][10];

        for(int i=0;i<10;i++){
            String str = in.next();
            for(int j=0;j<10;j++){
                arr[i][j] = str.charAt(j)=='X' ? 1 : str.charAt(j)=='.' ? 0 : -1;
            }
        }

        int cnt=0;
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                if(j<=5){
                    cnt=0;
                    for(int s=j;s<j+5;s++) cnt+=arr[i][s];
                    if(cnt==4) {out.println("YES");return;}
                }
                if(i<=5){
                    cnt=0;
                    for(int s=i;s<i+5;s++) cnt+=arr[s][j];
                    if(cnt==4) {out.println("YES");return;}
                }
                if(j<=5 && i<=5){
                    cnt=0;
                    for(int s=0;s<5;s++) cnt+= arr[i+s][j+s];
                    if(cnt==4) {out.println("YES");return;}
                }
                if(j>=4 && i<=5){
                    cnt=0;
                    for(int s=0;s<5;s++) cnt+= arr[i+s][j-s];
                    if(cnt==4) {out.println("YES");return;}
                }
            }
        }
        out.println("NO");
    }

    static class Reader {

    private InputStream mIs;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public Reader() {
        this(System.in);
    }

    public Reader(InputStream is) {
        mIs = is;
    }

    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();

    }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = mIs.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar++];
    }

    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 String next() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

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

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

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

    }
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        Reader in = new Reader();
        Main solver = new Main();
        solver.solve(out, in);
        out.flush();
        out.close();

    }
}

import java.util.Scanner;

public class Main {
	static char[][] field;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		field = new char[10][];
		String s;
		for (int i = 0; i < 10; i++) {
			s = sc.nextLine();
			field[i] = s.toCharArray();
		}
		if (go(0, 0, 1, 0, 0, 1) || go(0, 0, 0, 1, 1, 0) ||
			go(0,0, 0, 1, 1, -1) || go(9, 0, 0, 1, -1, -1) ||
			go(9, 9, -1, 0, 1, -1) || go(0, 9, 1, 0, -1, -1)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
	static boolean go(int startX, int startY, int nextX, int nextY, int stepX, int stepY) {
		while (startX >= 0 && startX < 10 && startY >= 0 && startY < 10) {
			int x = startX;
			int y = startY;
			int count = 0;
			int countSolid = 0;
			boolean wasEmpty = false;
			while (x >= 0 && x < 10 && y >= 0 && y < 10) {
				if (field[x][y] == 'O') {
					count = 0;
					countSolid = 0;
					wasEmpty = false;
				} else {
					if (field[x][y] == 'X') {
						countSolid++;
						count++;
					} else {
						if (wasEmpty) {
							count = countSolid + 1;
							countSolid = 0;
						} else {
							count++;
							countSolid = 0;
							wasEmpty = true;
						}
					}
					if (count > 4) return true;
				}
				x += stepX;
				y += stepY;
			}
			startX += nextX;
			startY += nextY;
		}
		return false;
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class B {

	static int N;
	static char[][] grid;

	public static void main(String[] args) throws Exception
	{
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		N = 10;
		grid = new char[N][N];
		for(int i = 0; i < N; i++)
			grid[i] = sc.next().toCharArray();
		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++)
				if(grid[i][j] == '.')
				{
					grid[i][j] = 'X';
					if(row() || col() || diag1() || diag2())
					{
						out.println("YES");
						out.flush();
						return;
					}
					grid[i][j] = '.';
				}
		out.println("NO");
		out.flush();
		out.close();
	}

	static boolean row()
	{
		int max = 0;
		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++)
			{
				int cur = 0;
				for(int k = j; k < N; k++)
					if(grid[i][k] == 'X')
						cur++;
					else
					{
						max = Math.max(max, cur);
						cur = 0;
					}
				max = Math.max(cur, max);
			}
		return max >= 5;
	}

	static boolean col()
	{
		int max = 0;
		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++)
			{
				int cur = 0;
				for(int k = i; k < N; k++)
					if(grid[k][j] == 'X')
						cur++;
					else
					{
						max = Math.max(max, cur);
						cur = 0;
					}
				max = Math.max(cur, max);
			}
		return max >= 5;
	}

	static boolean diag1()
	{
		int max = 0;
		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++)
			{
				int cur = 0;
				for(int k = i, l = j; k < N && l < N; k++, l++)
					if(grid[k][l] == 'X')
						cur++;
					else
					{
						max = Math.max(max, cur);
						cur = 0;
					}
				max = Math.max(cur, max);
			}
		return max >= 5;
	}

	static boolean diag2()
	{
		int max = 0;
		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++)
			{
				int cur = 0;
				for(int k = i, l = j; k < N && l >= 0; k++, l--)
					if(grid[k][l] == 'X')
						cur++;
					else
					{
						max = Math.max(max, cur);
						cur = 0;
					}
				max = Math.max(cur, max);
			}
		return max >= 5;
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {br = new BufferedReader(new InputStreamReader(system));}
		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public String nextLine()throws IOException{return br.readLine();}
		public int nextInt() throws IOException {return Integer.parseInt(next());}
		public double nextDouble() throws IOException {return Double.parseDouble(next());}
		public char nextChar()throws IOException{return next().charAt(0);}
		public Long nextLong()throws IOException{return Long.parseLong(next());}
		public boolean ready() throws IOException{return br.ready();}
		public void waitForInput(){for(long i = 0; i < 3e9; i++);}
	}
}

import java.util.Scanner;

public class game {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String[] s = new String[10];
        for (int i = 0; i < 10; i++) {
            s[i] = in.next();
        }
        int r = 0;
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 6; j++) {
                    if (s[i].indexOf(".", j) == s[i].indexOf("X", j + 1) - 1) {
                        if ((s[i].indexOf("X", j + 1) == s[i].indexOf("X", j + 2) - 1)&&(s[i].indexOf(".", j)!= -1)) {
                            if (s[i].indexOf("X", j + 2) == s[i].indexOf("X", j + 3) - 1) {
                                if (s[i].indexOf("X", j + 3) == s[i].indexOf("X", j + 4) - 1) {
                                    r = 1;
                                    break;
                                }
                            }
                        }
                    }
                    if ((s[i].indexOf("X", j) == s[i].indexOf(".", j + 1) - 1)&&(s[i].indexOf("X", j)!= -1)) {
                        if (s[i].indexOf(".", j + 1) == s[i].indexOf("X", j + 2) - 1) {
                            if (s[i].indexOf("X", j + 2) == s[i].indexOf("X", j + 3) - 1) {
                                if (s[i].indexOf("X", j + 3) == s[i].indexOf("X", j + 4) - 1) {
                                    r = 2;
                                    break;
                                }
                            }
                        }
                    }
                    if ((s[i].indexOf("X", j) == s[i].indexOf("X", j + 1) - 1)&&(s[i].indexOf("X", j)!= -1)) {
                        if (s[i].indexOf("X", j + 1) == s[i].indexOf(".", j + 2) - 1) {
                            if (s[i].indexOf(".", j + 2) == s[i].indexOf("X", j + 3) - 1) {
                                if (s[i].indexOf("X", j + 3) == s[i].indexOf("X", j + 4) - 1) {
                                    r = 3;
                                    break;
                                }
                            }
                        }
                    }
                    if ((s[i].indexOf("X", j) == s[i].indexOf("X", j + 1) - 1)&&(s[i].indexOf("X", j)!= -1)) {
                        if (s[i].indexOf("X", j + 1) == s[i].indexOf("X", j + 2) - 1) {
                            if (s[i].indexOf("X", j + 2) == s[i].indexOf(".", j + 3) - 1) {
                                if (s[i].indexOf(".", j + 3) == s[i].indexOf("X", j + 4) - 1) {
                                    r = 4;
                                    break;
                                }
                            }
                        }
                    }
                    if ((s[i].indexOf("X", j) == s[i].indexOf("X", j + 1) - 1)&&(s[i].indexOf("X", j)!= -1)) {
                        if (s[i].indexOf("X", j + 1) == s[i].indexOf("X", j + 2) - 1) {
                            if (s[i].indexOf("X", j + 2) == s[i].indexOf("X", j + 3) - 1) {
                                if (s[i].indexOf("X", j + 3) == s[i].indexOf(".", j + 4) - 1) {
                                    r = 5;
                                    break;
                                }
                            }
                        }
                    }
                }

        }
        if (r == 0) {
            for (int i = 0; i < 6; i++) {
                for (int j = 0; j < 10; j++) {
                        if ((s[i].indexOf("X", j) == s[i + 1].indexOf("X", j))&&(s[i].indexOf("X", j)!= -1)) {
                            if (s[i + 1].indexOf("X", j) == s[i + 2].indexOf("X", j)) {
                                if (s[i + 2].indexOf("X", j) == s[i + 3].indexOf("X", j)) {
                                    if (s[i + 3].indexOf("X", j) == s[i + 4].indexOf(".", j)) {
                                        r = 6;
                                        break;
                                    }
                                }
                            }
                        }
                        if ((s[i].indexOf("X", j) == s[i + 1].indexOf("X", j))&&(s[i].indexOf("X", j)!= -1)) {
                            if (s[i + 1].indexOf("X", j) == s[i + 2].indexOf("X", j)) {
                                if (s[i + 2].indexOf("X", j) == s[i + 3].indexOf(".", j)) {
                                    if (s[i + 3].indexOf(".", j) == s[i + 4].indexOf("X", j)) {
                                        r = 7;
                                        break;
                                    }
                                }
                            }
                        }
                        if ((s[i].indexOf("X", j) == s[i + 1].indexOf("X", j))&&(s[i].indexOf("X", j)!= -1)) {
                            if (s[i + 1].indexOf("X", j) == s[i + 2].indexOf(".", j)) {
                                if (s[i + 2].indexOf(".", j) == s[i + 3].indexOf("X", j)) {
                                    if (s[i + 3].indexOf("X", j) == s[i + 4].indexOf("X", j)) {
                                        r = 8;
                                        break;
                                    }
                                }
                            }
                        }
                        if ((s[i].indexOf("X", j) == s[i + 1].indexOf(".", j))&&(s[i].indexOf("X", j)!= -1)) {
                            if (s[i + 1].indexOf(".", j) == s[i + 2].indexOf("X", j)) {
                                if (s[i + 2].indexOf("X", j) == s[i + 3].indexOf("X", j)) {
                                    if (s[i + 3].indexOf("X", j) == s[i + 4].indexOf("X", j)) {
                                        r = 9;
                                        break;
                                    }
                                }
                            }
                        }
                        if ((s[i].indexOf(".", j) == s[i + 1].indexOf("X", j))&&(s[i].indexOf(".", j)!= -1)) {
                            if (s[i + 1].indexOf("X", j) == s[i + 2].indexOf("X", j)) {
                                if (s[i + 2].indexOf("X", j) == s[i + 3].indexOf("X", j)) {
                                    if (s[i + 3].indexOf("X", j) == s[i + 4].indexOf("X", j)) {
                                        r = 10;
                                        break;
                                    }
                                }
                            }
                        }
                    }

            }
        }
        if (r == 0) {
            for (int i = 0; i < 6; i++) {
                for (int j = 0; j < 6; j++) {
                        if ((s[i].indexOf("X", j) == s[i + 1].indexOf("X", j + 1) - 1)&&(s[i].indexOf("X", j)!= -1)) {
                            if (s[i + 1].indexOf("X", j + 1) == s[i + 2].indexOf("X", j + 2) - 1) {
                                if (s[i + 2].indexOf("X", j + 2) == s[i + 3].indexOf("X", j + 3) - 1) {
                                    if (s[i + 3].indexOf("X", j + 3) == s[i + 4].indexOf(".", j + 4) - 1) {
                                        r = 11;
                                        break;
                                    }
                                }
                            }
                        }
                        if ((s[i].indexOf(".", j) == s[i + 1].indexOf("X", j + 1) - 1)&&(s[i].indexOf(".", j)!= -1)) {
                            if (s[i + 1].indexOf("X", j + 1) == s[i + 2].indexOf("X", j + 2) - 1) {
                                if (s[i + 2].indexOf("X", j + 2) == s[i + 3].indexOf("X", j + 3) - 1) {
                                    if (s[i + 3].indexOf("X", j + 3) == s[i + 4].indexOf("X", j + 4) - 1) {
                                        r = 12;
                                        break;
                                    }
                                }
                            }
                        }
                        if ((s[i].indexOf("X", j) == s[i + 1].indexOf(".", j + 1) - 1)&&(s[i].indexOf("X", j)!= -1)){
                            if (s[i + 1].indexOf(".", j + 1) == s[i + 2].indexOf("X", j + 2) - 1) {
                                if (s[i + 2].indexOf("X", j + 2) == s[i + 3].indexOf("X", j + 3) - 1) {
                                    if (s[i + 3].indexOf("X", j + 3) == s[i + 4].indexOf("X", j + 4) - 1) {
                                        r = 13;
                                        break;
                                    }
                                }
                            }
                        }
                        if ((s[i].indexOf("X", j) == s[i + 1].indexOf("X", j + 1) - 1)&&(s[i].indexOf("X", j)!= -1)) {
                            if (s[i + 1].indexOf("X", j + 1) == s[i + 2].indexOf(".", j + 2) - 1) {
                                if (s[i + 2].indexOf(".", j + 2) == s[i + 3].indexOf("X", j + 3) - 1) {
                                    if (s[i + 3].indexOf("X", j + 3) == s[i + 4].indexOf("X", j + 4) - 1) {
                                        r = 14;
                                        break;
                                    }
                                }
                            }
                        }
                        if ((s[i].indexOf("X", j) == s[i + 1].indexOf("X", j + 1) - 1)&&(s[i].indexOf("X", j)!= -1)) {
                            if (s[i + 1].indexOf("X", j + 1) == s[i + 2].indexOf("X", j + 2) - 1) {
                                if (s[i + 2].indexOf("X", j + 2) == s[i + 3].indexOf(".", j + 3) - 1) {
                                    if (s[i + 3].indexOf(".", j + 3) == s[i + 4].indexOf("X", j + 4) - 1) {
                                        r = 15;
                                        break;
                                    }
                                }
                            }
                        }
                    }

            }
        }
        if (r == 0) {
            for (int i = 0; i <6; i++) {
                for (int j = 9; j > 3; j--) {
                        if ((s[i].indexOf("X", j) == s[i + 1].indexOf("X", j - 1) + 1)&&(s[i].indexOf("X", j)!= -1)) {
                            if (s[i + 1].indexOf("X", j - 1) == s[i + 2].indexOf("X", j - 2) + 1) {
                                if (s[i + 2].indexOf("X", j - 2) == s[i + 3].indexOf("X", j - 3) + 1) {
                                    if (s[i + 3].indexOf("X", j - 3) == s[i + 4].indexOf(".", j - 4) + 1) {
                                        r = 16;
                                        break;
                                    }
                                }
                            }
                        }
                        if ((s[i].indexOf("X", j) == s[i + 1].indexOf("X", j - 1) + 1)&&(s[i].indexOf("X", j)!= -1)) {
                            if (s[i + 1].indexOf("X", j - 1) == s[i + 2].indexOf("X", j - 2) + 1) {
                                if (s[i + 2].indexOf("X", j - 2) == s[i + 3].indexOf(".", j - 3) + 1) {
                                    if (s[i + 3].indexOf(".", j - 3) == s[i + 4].indexOf("X", j - 4) + 1) {
                                        r = 17;
                                        break;
                                    }
                                }
                            }
                        }
                        if ((s[i].indexOf(".", j) == s[i + 1].indexOf("X", j - 1) + 1)&&(s[i].indexOf(".", j)!= -1)) {
                            if (s[i + 1].indexOf("X", j - 1) == s[i + 2].indexOf("X", j - 2) + 1) {
                                if (s[i + 2].indexOf("X", j - 2) == s[i + 3].indexOf("X", j - 3) + 1) {
                                    if (s[i + 3].indexOf("X", j - 3) == s[i + 4].indexOf("X", j - 4) + 1) {
                                        r = 18;
                                        break;
                                    }
                                }
                            }
                        }
                        if ((s[i].indexOf("X", j) == s[i + 1].indexOf(".", j - 1) + 1)&&(s[i].indexOf("X", j)!= -1)) {
                            if (s[i + 1].indexOf(".", j - 1) == s[i + 2].indexOf("X", j - 2) + 1) {
                                if (s[i + 2].indexOf("X", j - 2) == s[i + 3].indexOf("X", j - 3) + 1) {
                                    if (s[i + 3].indexOf("X", j - 3) == s[i + 4].indexOf("X", j - 4) + 1) {
                                        r = 19;
                                        break;
                                    }
                                }
                            }
                        }
                        if ((s[i].indexOf("X", j) == s[i + 1].indexOf("X", j - 1) + 1)&&(s[i].indexOf("X", j)!= -1)) {
                            if (s[i + 1].indexOf("X", j - 1) == s[i + 2].indexOf(".", j - 2) + 1) {
                                if (s[i + 2].indexOf(".", j - 2) == s[i + 3].indexOf("X", j - 3) + 1) {
                                    if (s[i + 3].indexOf("X", j - 3) == s[i + 4].indexOf("X", j - 4) + 1) {
                                        r = 20;
                                        break;
                                    }
                                }
                            }
                        }

                }
            }
        }

        if (r == 0) System.out.println("NO");
        else System.out.println("YES");

    }
}

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class FiveInARow implements Closeable {

    private InputReader in = new InputReader(System.in);
    private PrintWriter out = new PrintWriter(System.out);

    public void solve() {
        char[][] x = new char[10][10];
        for (int i = 0; i < 10; i++) {
            x[i] = in.next().toCharArray();
        }
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                if (x[i][j] == '.') {
                    x[i][j] = 'X';
                    if (ok(x)) {
                        out.println("YES");
                        return;
                    }
                    x[i][j] = '.';
                }
            }
        }
        out.println("NO");
    }

    private boolean ok(char[][] x) {
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                if (row(x, i, j) || col(x, i, j) || diagonal(x, i, j, 1, 1) || diagonal(x, i, j, 1, -1) || diagonal(x, i, j, -1, 1) || diagonal(x, i, j, -1, -1)) {
                    return true;
                }
            }
        }
        return false;
    }

    private boolean row(char[][] x, int i, int j) {
        for (int k = 0; k < 5; k++) {
            if (i + k == 10) return false;
            if (x[i + k][j] != 'X') return false;
        }
        return true;
    }

    private boolean col(char[][] x, int i, int j) {
        for (int k = 0; k < 5; k++) {
            if (j + k == 10) return false;
            if (x[i][j + k] != 'X') return false;
        }
        return true;
    }

    private boolean diagonal(char[][] x, int i, int j, int a, int b) {
        for (int k = 0; k < 5; k++) {
            int p = i + k * a, q = j + k * b;
            if (p < 0 || p >= 10) return false;
            if (q < 0 || q >= 10) return false;
            if (x[p][q] != 'X') return false;
        }
        return true;
    }
    @Override
    public void close() throws IOException {
        in.close();
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public 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 ni() {
            return Integer.parseInt(next());
        }

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

        public void close() throws IOException {
            reader.close();
        }
    }

    public static void main(String[] args) throws IOException {
        try (FiveInARow instance = new FiveInARow()) {
            instance.solve();
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vaibhav Pulastya
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BFiveInARow solver = new BFiveInARow();
        solver.solve(1, in, out);
        out.close();
    }

    static class BFiveInARow {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String[] grid = in.nextStringArray(10);

            for (int i = 0; i < 10; i++) {
                for (int j = 0; j < 10; j++) {
                    // horiz
                    int emp = 0;
                    int x = 0;
                    for (int k = j; k < Math.min(j + 5, 10); k++) {
                        if (grid[i].charAt(k) == 'X') x++;
                        if (grid[i].charAt(k) == '.') emp++;
                    }
                    if (x == 4 && emp == 1) {
                        out.println("YES");
                        return;
                    }
                    x = 0;
                    emp = 0;

                    for (int k = i; k < Math.min(i + 5, 10); k++) {
                        if (grid[k].charAt(j) == 'X') x++;
                        if (grid[k].charAt(j) == '.') emp++;
                    }

                    if (x == 4 && emp == 1) {
                        out.println("YES");
                        return;
                    }

                    x = 0;
                    emp = 0;

                    for (int k = 0; k < 5 && i + k < 10 && j + k < 10; k++) {
                        if (grid[i + k].charAt(j + k) == 'X') x++;
                        if (grid[i + k].charAt(j + k) == '.') emp++;
                    }
                    if (x == 4 && emp == 1) {
                        out.println("YES");
                        return;
                    }

                    x = 0;
                    emp = 0;

                    for (int k = 0; k < 5 && i + k < 10 && j - k >= 0; k++) {
                        if (grid[i + k].charAt(j - k) == 'X') x++;
                        if (grid[i + k].charAt(j - k) == '.') emp++;
                    }

                    if (x == 4 && emp == 1) {
                        out.println("YES");
                        return;
                    }

                }
            }
            out.println("NO");
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String[] nextStringArray(int size) {
            String[] array = new String[size];
            for (int i = 0; i < size; i++)
                array[i] = next();
            return array;
        }

    }
}

import java.util.Scanner;

public class TestThree {
    private char[][] playField;

    public TestThree(char[][] playField) {
        this.playField = playField;
    }

    public static void main(String[] args) {

        Scanner reader = new Scanner(System.in);
        char[][] playField = new char[10][];
        for (int i = 0; i < 10; i++) {
            String row = reader.nextLine();
            playField[i] = row.toCharArray();
        }

        TestThree game=new TestThree(playField);

        System.out.println(game.canAliceWinInOneMove());

    }

    public String canAliceWinInOneMove(){

        for (int row = 0; row < 10; row++) {
            for (int column = 0; column < 10; column++) {

                if (checkFiveInColumn(playField, row, column) ||
                        checkFiveInRow(playField, row, column) ||
                        checkFiveInDiagonalLeft(playField, row, column) ||
                        checkFiveInDiagonalRight(playField, row, column)) {
                    return "YES";
                }
            }
        }

        return "NO";
    }

    private boolean checkFiveInRow(char[][] playField, int column, int row) {

        if ((column + 4) >= 10) {
            return false;
        }
        int count = 0;
        int i = column;
        for (int j = 0; j < 5; j++) {
            if (playField[row][i] == 'O') {
                return false;
            }
            if (playField[row][i] == 'X') {
                count++;
            }
            i++;
        }
        return count == 4;

    }

    private boolean checkFiveInColumn(char[][] playField, int column, int row) {

        if ((row + 4) >= 10) {
            return false;
        }
        int count = 0;
        int i = row;
        for (int j = 0; j < 5; j++) {
            if (playField[i][column] == 'O') {
                return false;
            }
            if (playField[i][column] == 'X') {
                count++;
            }
            i++;
        }
        return count == 4;
    }

    private boolean checkFiveInDiagonalRight(char[][] playField, int column, int row) {
        if ((column - 4) < 0 || (row + 4) >= 10) {
            return false;
        }

        int count = 0;
        for (int j = 0; j < 5; j++) {
            if (playField[row + j][column - j] == 'O') {
                return false;
            }
            if (playField[row + j][column - j] == 'X') {
                count++;
            }
        }

        return count == 4;
    }

    private boolean checkFiveInDiagonalLeft(char[][] playField, int column, int row) {
        if ((row + 4) >= 10 || (column + 4) >= 10) {
            return false;
        }

        int count = 0;
        for (int j = 0; j < 5; j++) {
            if (playField[row + j][column + j] == 'O') {
                return false;
            }
            if (playField[row + j][column + j] == 'X') {
                count++;
            }
        }
        return count == 4;

    }
}

import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Code_Tests {

	static boolean isvalaid(int i , int j){
		boolean res = false;
		if(i>=0 && i <10 && j >=0 && j < 10 )
			res = true;
		return res;
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner = new Scanner(System.in);

		char[] Stamm = {'.','X','X','X','X'};
		char [] [] a = new char[10][10];
		for(int i = 0 ; i < 10 ; i++){
			String temp = scanner.next();
			for(int j =0 ; j < 10 ; j++){
				a[i][j] =  temp.charAt(j);
			}
		}
		boolean win = false;

		for(int i = 0 ; i < 10 ; i++){
			for(int j = 0 ; j  < 10 ; j++)
			{
				char[] temp1 = new char[5];
				char[] temp2 = new char[5];
				for(int k =i ;  k < i+5 && isvalaid(k,k);k++){
					temp1[k-i] = a[k][j];
				}
				for(int  z=j; z < j+5  && isvalaid(z,z); z++){
				temp2[z-j] = a[i][z];
				}
				Arrays.sort(temp1);
				Arrays.sort(temp2);
				if(Arrays.equals(Stamm,temp1) || Arrays.equals(Stamm,temp2)){
					win = true ;
				}

			}
		}

		for(int i = 0 ; i < 10 ; i++){
			for(int j = 0 ; j  < 10 ; j++)
			{
				char[] temp1 = new char[5];
				char[] temp2 = new char[5];
				for(int k = i, d=j ; k > i - 5 && d > j - 5 && isvalaid(k,d);k--, d--  ){
					temp1[i-k] = a[k][d];
				}
				Arrays.sort(temp1);
				for(int k = i, d=j ; k < i + 5 && d < j + 5 && isvalaid(k,d);k++, d++  ){
					temp2[k - i] = a[k][d];
				}
				Arrays.sort(temp2);
				if(Arrays.equals(Stamm,temp1) || Arrays.equals(Stamm,temp2)){
					win = true ;
				}
			}
		}

		for(int i = 0 ; i < 10 ; i++){
			for(int j = 0 ; j  < 10 ; j++)
			{
				char[] temp1 = new char[5];
				char[] temp2 = new char[5];
				for(int k = i, d=j ; k > i - 5 && d < j + 5 && isvalaid(k,d);k--, d++  ){
					temp1[i-k] = a[k][d];
				}
				Arrays.sort(temp1);
				for(int k = i, d=j ; k < i + 5 && d > j - 5 && isvalaid(k,d);k++, d--  ){
					temp2[k - i] = a[k][d];
				}
				Arrays.sort(temp2);

				if(Arrays.equals(Stamm,temp1) || Arrays.equals(Stamm,temp2)){
					win = true ;
				}
			}
		}

		if(win)System.out.println("YES");
		else System.out.println("NO");

	}
}

import java.util.Scanner;

public class TestThree {

    public static void main(String[] args) {

        Scanner reader = new Scanner(System.in);
        char[][] playField = new char[10][];
        for (int i = 0; i < 10; i++) {
            String row = reader.nextLine();
            playField[i] = row.toCharArray();
        }

        for (int row = 0; row < 10; row++) {
            for (int column = 0; column < 10; column++) {

                if (checkFiveInColumn(playField, row, column) ||
                        checkFiveInRow(playField, row, column) ||
                        checkFiveInDiagonalLeft(playField, row, column) ||
                        checkFiveInDiagonalRight(playField, row, column)) {
                    System.out.println("YES");
                    return;
                }
            }
        }

        System.out.println("NO");
    }

    private static boolean checkFiveInRow(char[][] playField, int column, int row) {

        if ((column + 4) >= 10) {
            return false;
        }
        int count = 0;
        int i = column;
        for (int j = 0; j < 5; j++) {
            if (playField[row][i] == 'O') {
                return false;
            }
            if (playField[row][i] == 'X') {
                count++;
            }
            i++;
        }
        return count == 4;

    }

    private static boolean checkFiveInColumn(char[][] playField, int column, int row) {

        if ((row + 4) >= 10) {
            return false;
        }
        int count = 0;
        int i = row;
        for (int j = 0; j < 5; j++) {
            if (playField[i][column] == 'O') {
                return false;
            }
            if (playField[i][column] == 'X') {
                count++;
            }
            i++;
        }
        return count == 4;
    }

    private static boolean checkFiveInDiagonalRight(char[][] playField, int column, int row) {
        if ((column - 4) < 0 || (row + 4) >= 10) {
            return false;
        }

        int count = 0;
        for (int j = 0; j < 5; j++) {
            if (playField[row + j][column - j] == 'O') {
                return false;
            }
            if (playField[row + j][column - j] == 'X') {
                count++;
            }
        }

        boolean result = (count == 4);
        return result;
    }

    private static boolean checkFiveInDiagonalLeft(char[][] playField, int column, int row) {
        if ((row + 4) >= 10 || (column + 4) >= 10) {
            return false;
        }

        int count = 0;
        for (int j = 0; j < 5; j++) {
            if (playField[row + j][column + j] == 'O') {
                return false;
            }
            if (playField[row + j][column + j] == 'X') {
                count++;
            }
        }
        boolean result = (count == 4);
        return result;

    }
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class template
{
	static char grid[][];
	static int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
	static int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};
	public static void main(String[] args)
	{
		FastScanner in = new FastScanner();
		int n = 10;
		grid = new char[n][n];

		for(int i = 0; i < n; i++)
			grid[i] = in.next().toCharArray();

		boolean good = false;
		loops: for(int i = 0; i < 10; i++)
		{
			for(int j = 0; j < 10; j++)
			{
				if(grid[i][j] == 'X')
				for(int k = 0; k < dx.length; k++)
				{
					if(cnt(i, j, k, 0) >= 5)
					{
						good = true;
						break loops;
					}
				}
			}
		}

		if(good)
			System.out.println("YES");
		else
			System.out.println("NO");
	}

	private static int cnt(int i, int j, int k, int flag)
	{
		int cnt = 1;
		int nextX = i + dx[k];
		int nextY = j + dy[k];
		if(!inBounds(nextX, nextY)) return cnt;
		if(grid[nextX][nextY] == '.' && flag == 1) return cnt;
		if(grid[nextX][nextY] == 'O') return cnt;

		cnt += cnt(nextX, nextY, k, Math.max(flag, grid[nextX][nextY] == '.' ? 1 : 0));

		return cnt;
	}

	private static boolean inBounds(int i, int j)
	{
		return i >= 0 && i < 10 && j >= 0 && j < 10;
	}

	public static class FastScanner
	{
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s)
		{
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public FastScanner()
		{
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken()
		{
			while (st == null || !st.hasMoreElements())
			{
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		String next()
		{
			return nextToken();
		}
	}
}

import java.util.*;

public class CODE {

    static Scanner sc = new Scanner(System.in);
    static char arr[][] = new char[10][10];

    static boolean isHozRight(int x, int y) {
        int c = 0;
        int dots = 0;
        for (int i = y; i < y + 5; i++) {
            try {
                if (arr[x][i] == 'X') {
                    c++;
                }
                if (arr[x][i] == '.') {
                    dots++;
                }
            } catch (Exception ex) {
                return false;
            }
        }

        if (dots > 0) {
            dots = 1;
        }

        return c + dots == 5;
    }

    static boolean isHozLeft(int x, int y) {
        int c = 0;
        int dots = 0;

        for (int i = y; i > y - 5; i--) {
            try {
                if (arr[x][i] == 'X') {
                    c++;
                }
                if (arr[x][i] == '.') {
                    dots++;
                }
            } catch (Exception ex) {
                return false;
            }
        }
        if (dots > 0) {
            dots = 1;
        }

        return c + dots == 5;
    }

    static boolean isVerUp(int x, int y) {
        int c = 0;
        int dots = 0;

        for (int i = x; i < x + 5; i++) {
            try {
                if (arr[i][y] == 'X') {
                    c++;
                }
                if (arr[i][y] == '.') {
                    dots++;
                }
            } catch (Exception ex) {
                return false;
            }
        }

        if (dots > 0) {
            dots = 1;
        }

        return c + dots == 5;
    }

    static boolean isVerDown(int x, int y) {
        int c = 0;
        int dots = 0;

        for (int i = x; i > x - 5; i--) {
            try {
                if (arr[i][y] == 'X') {
                    c++;
                }
                if (arr[i][y] == '.') {
                    dots++;
                }
            } catch (Exception ex) {
                return false;
            }
        }

        if (dots > 0) {
            dots = 1;
        }

        return c + dots == 5;
    }

    static boolean isDia1(int x, int y) {
        int c = 0;
        int dots = 0;

        for (int i = 0; i < 5; i++) {
            try {
                if (arr[x - i][y - i] == 'X') {
                    c++;
                }
                if (arr[x - i][y - i] == '.') {
                    dots++;
                }
            } catch (Exception ex) {
                return false;
            }
        }

        if (dots > 0) {
            dots = 1;
        }

        return c + dots == 5;
    }

    static boolean isDia2(int x, int y) {
        int c = 0;
        int dots = 0;

        for (int i = 0; i < 5; i++) {
            try {
                if (arr[x + i][y + i] == 'X') {
                    c++;
                }
                if (arr[x + i][y + i] == '.') {
                    dots++;
                }
            } catch (Exception ex) {
                return false;
            }
        }
        if (dots > 0) {
            dots = 1;
        }

        return c + dots == 5;
    }

    static boolean isDia3(int x, int y) {
        int c = 0;
        int dots = 0;

        for (int i = 0; i < 5; i++) {
            try {
                if (arr[x + i][y - i] == 'X') {
                    c++;
                }
                if (arr[x + i][y - i] == '.') {
                    dots++;
                }
            } catch (Exception ex) {
                return false;
            }
        }
        if (dots > 0) {
            dots = 1;
        }

        return c + dots == 5;
    }

    static boolean isDia4(int x, int y) {
        int c = 0;
        int dots = 0;

        for (int i = 0; i < 5; i++) {
            try {
                if (arr[x - i][y + i] == 'X') {
                    c++;
                }
                if (arr[x - i][y + i] == '.') {
                    dots++;
                }
            } catch (Exception ex) {
                return false;
            }
        }
        if (dots > 0) {
            dots = 1;
        }

        return c + dots == 5;
    }

    static boolean is(int x, int y) {
        return isHozRight(x, y) || isHozRight(x, y) || isVerUp(x, y) || isVerDown(x, y) || isDia1(x, y) || isDia2(x, y) || isDia3(x, y) || isDia4(x, y);
    }

    public static void main(String[] args) {
        for (int x = 0; x < 10; x++) {
            String s = sc.next();
            arr[x] = s.toCharArray();
        }

        for (int x = 0; x < 10; x++) {
            for (int y = 0; y < 10; y++) {
                if (is(x, y)) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");
    }
}

import java.util.Scanner;

/*
XXOXX.....
.....OOOO.
..........
..........
..........
.........X
........X.
.......X..
......X...
..........

 */
public class P825B
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		char[][] grid = new char[10][10];
		for (int i = 0; i < grid.length; i++)
		{
			grid[i] = scan.next().toCharArray();
		}
		boolean win = false;
		for (int i = 0; i < grid.length; i++)
		{
			for (int j = 0; j < grid[0].length; j++)
			{
				if (grid[i][j] == '.')
				{
					grid[i][j] = 'X';
					for (int a = 0; a < grid.length; a++)
					{
						for (int b = 0; b < grid[0].length; b++)
						{
							if (win(grid, a, b, 0, 1, 0))
								win = true;
							if (win(grid, a, b, 1, 0, 0))
								win = true;
							if (win(grid, a, b, 1, 1, 0))
								win = true;
							if (win(grid, a, b, 1, -1, 0))
								win = true;
						}
					}
					grid[i][j] = '.';
				}
			}
		}
		System.out.println(win ? "YES" : "NO");
	}

	private static boolean win(char[][] grid, int r, int c, int dr, int dc, int t)
	{
		if (t >= 5)
			return true;
		if (r < 0 || c < 0 || r >= 10 || c >= 10)
			return false;
		return grid[r][c] == 'X' && win(grid, r+dr, c+dc, dr, dc, t+1);
	}
}

import java.util.Scanner;

/**
 * Created by Berry on 17-7-20.
 */
public class Binaryprotocol {

    public static void main(String[] args){
        Scanner stdin = new Scanner( System.in );
        String[] matrix = new String[10];
        for( int i = 0; i < 10; i++ ){
            matrix[i] = stdin.next();
        }

        for( int i = 0; i < 10; i++ ){
            String str = matrix[i];
            for( int j = 0; j < 10; j++ ){
                char c = str.charAt(j);
                if( c == '.' ) {
                    int left = findLeft(i, j, matrix);
                    int right = findRight(i, j, matrix);
                    int leftUp = findLeftUp(i, j, matrix);
                    int rightDown = findRightDown(i, j, matrix);
                    int rightUp = findRightUp(i, j, matrix);
                    int leftDown = findLeftDown(i, j, matrix);
                    int up = findUp(i, j, matrix);
                    int down = findDown(i, j, matrix);

                    if (left + right >= 4 ||
                            up + down >=4 ||
                            leftUp + rightDown >= 4 ||
                            rightUp + leftDown >= 4) {
                        System.out.println("YES");
                        return;
                    }
                }
            }
        }

        System.out.println("NO");

    }

    private static int findLeft(int x, int y, String[] matrix){
        int count = 0;
        y--;
        while( y >= 0 && matrix[x].charAt(y) == 'X'){
            count++;
            y--;
        }

        return count;
    }

    private static int findRight(int x, int y, String[] matrix){
        int count = 0;
        y++;
        while( y < 10 && matrix[x].charAt(y) == 'X'){
            count++;
            y++;
        }

        return count;
    }

    private static int findUp(int x, int y, String[] matrix){
        int count = 0;
        x--;
        while( x >= 0 && matrix[x].charAt(y) == 'X' ){
            count++;
            x--;
        }

        return count;
    }

    private static int findDown(int x, int y, String[] matrix){
        int count = 0;
        x++;
        while( x < 10 && matrix[x].charAt(y) == 'X' ){
            count++;
            x++;
        }

        return count;
    }

    private static int findLeftUp(int x, int y, String[] matrix){
        int count = 0;
        x--;
        y--;
        while( x >= 0 && y >= 0 && matrix[x].charAt(y) == 'X'){
            count++;
            x--;
            y--;
        }

        return count;
    }

    private static int findRightDown(int x, int y, String[] matrix){
        int count = 0;
        x++;
        y++;
        while( x < 10 && y < 10 && matrix[x].charAt(y) == 'X'){
            count++;
            x++;
            y++;
        }

        return count;
    }

    private static int findRightUp(int x, int y, String[] matrix){
        int count = 0;
        x--;
        y++;
        while( x >= 0 && y < 10 && matrix[x].charAt(y) == 'X'){
            count++;
            x--;
            y++;
        }

        return count;
    }

    private static int findLeftDown(int x, int y, String[] matrix){
        int count = 0;
        x++;
        y--;
        while( x < 10 && y >= 0 && matrix[x].charAt(y) == 'X'){
            count++;
            x++;
            y--;
        }

        return count;
    }
}

import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

import static java.lang.Math.*;

public class Main implements Runnable
{
	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;
		private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars==-1)
				throw new InputMismatchException();

			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}

				if(numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine()
		{
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-')
			{
				sgn = -1;
				c = read();
			}

			int res = 0;
			do
			{
				if(c<'0'||c>'9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			long res = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
				return res * sgn;
		}

		public double nextDouble()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.')
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.')
			{
				c = read();
				double m = 1;
				while (!isSpaceChar(c))
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public String readString()
		{
			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 boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next()
		{
			return readString();
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}

	public static void main(String args[]) throws Exception
	{
		new Thread(null, new Main(),"Main",1<<26).start();
	}
	static int max(int a,int b)
    {
        if(a>b)
            return a;
            else
            return b;
    }
	public void run()
	{
		InputReader sc= new InputReader(System.in);
		PrintWriter w= new PrintWriter(System.out);
	    String board[]=new String[10];
        int flag=0;
        for(int i=0;i<10;i++)
        board[i]=sc.next();
        for(int i=0;i<10;i++)
        {
            for(int j=0;j<10;j++)
            {
                if(i<=5)
                {
                int count1=0,count2=0;
                    for(int k=i;k<=i+4;k++)
                    {
                        if(board[k].charAt(j)=='X')
                            count1++;
                        if(board[k].charAt(j)=='.')
                            count2++;
                    }
                    if(count1==4&&count2==1)
                    flag=1;
                }
                if(j<=5)
                {
                int count1=0,count2=0;
                    for(int k=j;k<=j+4;k++)
                    {
                        if(board[i].charAt(k)=='X')
                            count1++;
                        if(board[i].charAt(k)=='.')
                            count2++;
                    }
                    if(count1==4&&count2==1)
                    flag=1;
                }
                if(i<=5&&j<=5)
                {
                int count1=0,count2=0;
                    for(int k=0;k<=4;k++)
                    {
                        if(board[i+k].charAt(j+k)=='X')
                            count1++;
                        if(board[i+k].charAt(j+k)=='.')
                            count2++;
                    }
                    if(count1==4&&count2==1)
                    flag=1;
                }
                if(i<=5&&j>=4)
                {
                int count1=0,count2=0;
                    for(int k=0;k<=4;k++)
                    {
                        if(board[i+k].charAt(j-k)=='X')
                            count1++;
                        if(board[i+k].charAt(j-k)=='.')
                            count2++;
                    }
                    if(count1==4&&count2==1)
                    flag=1;
                }
            }
        }
        if(flag==1)
            w.print("YES");
        else
            w.print("NO");
		w.close();
	}
}

/*
LANG: JAVA
TASK:
*/

import java.io.*;
import java.util.*;
public class cf
{
	public static void main(String[] args) throws IOException
	{
		Scanner c = new Scanner(System.in);
		String str = c.next();
		int[][] grid = new int[str.length()][str.length()];

		for(int j=0; j<str.length(); j++) grid[0][j] = str.charAt(j)=='X'?1:(str.charAt(j)=='.'?0:-1);

		for(int i=0; i<str.length()-1; i++)
		{
			str = c.next();
			for(int j=0; j<str.length(); j++) grid[i+1][j] = str.charAt(j)=='X'?1:(str.charAt(j)=='.'?0:-1);
		}

		boolean yes=false;
		int move[][] = {{0,1},{0,-1},{1,0},{-1,0},{1,1},{1,-1},{-1,-1},{-1,1}};
		for(int i=0; i<str.length(); i++)
		{
			for(int j=0; j<str.length(); j++)
			{
				int x=i, y=j;
				for(int k=0; k<move.length; k++)
				{
					x-=move[k][0]; y-=move[k][1];

					int count = 0;

					for(int l=0; l<5; l++)
					{
						x+=move[k][0]; y+=move[k][1];
						count += (x<10&&y<10&&x>=0&&y>=0)?grid[x][y]:-1;
					}
					if(count==4)
					{
						yes=true;
//						System.out.println(i+" "+j+" "+k);
					}
				}
			}
		}

		System.out.println(yes?"YES":"NO");
	}
}

/*
LANG: JAVA
TASK:
*/

import java.io.*;
import java.util.*;
public class cf
{
	public static void main(String[] args) throws IOException
	{
		Scanner c = new Scanner(System.in);
		String bob = "l";
		String str = c.next();
		int[][] grid = new int[str.length()][str.length()];

		for(int j=0; j<str.length(); j++) grid[0][j] = str.charAt(j)=='X'?1:(str.charAt(j)=='.'?0:-1);

		for(int i=0; i<str.length()-1; i++)
		{
			str = c.next();
			for(int j=0; j<str.length(); j++) grid[i+1][j] = str.charAt(j)=='X'?1:(str.charAt(j)=='.'?0:-1);
		}

		boolean yes=false;
		int move[][] = {{0,1},{0,-1},{1,0},{-1,0},{1,1},{1,-1},{-1,-1},{-1,1}};
		for(int i=0; i<str.length(); i++)
		{
			for(int j=0; j<str.length(); j++)
			{
				int x=i, y=j;
				for(int k=0; k<move.length; k++)
				{
					x-=move[k][0]; y-=move[k][1];

					int count = 0;

					for(int l=0; l<5; l++)
					{
						x+=move[k][0]; y+=move[k][1];
						count += (x<10&&y<10&&x>=0&&y>=0)?grid[x][y]:-1;
					}
					if(count==4)
					{
						yes=true;
//						System.out.println(i+" "+j+" "+k);
					}
				}
			}
		}

		System.out.println(yes?"YES":"NO");
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author sys_coder
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            char[][] mat = new char[10][10];
            for (int i = 0; i < 10; i++) {
                mat[i] = in.nextString().toCharArray();
            }
            for (int i = 0; i < 10; i++) {
                for (int j = 0; j < 10; j++) {
                    if (mat[i][j] == '.') {
                        mat[i][j] = 'X';
                        boolean flag = check(mat, i, j, 1, 0) || check(mat, i, j, 0, 1) || check(mat, i, j, 1, 1) || check(mat, i, j, -1, 1);
                        mat[i][j] = '.';
                        if (flag) {
                            out.print("YES");
                            return;
                        }
                    }
                }

            }
            out.print("NO");
        }

        private boolean check(char[][] mat, int i, int j, int i1, int i2) {
            int Xs = 0;

//        System.out.println("\t2nd for "+i+" "+j);
            for (int k = -4; k <= 4; k++) {
                int start = 0;
                for (int l = k; l <= k + 4; l++) {
//           for (int l =-2; l <=2 ; l++) {
//                System.out.println("\t\t"+(i+l*i1)+" "+(j+l*i2));
                    if (valid(i + l * i1, j + l * i2) && mat[i + l * i1][j + l * i2] == 'X')
                        Xs++;
                }
                if (Xs == 5)
                    return true;

                Xs = 0;
            }

            return false;
        }

        private boolean valid(int i, int j) {
            if (i >= 0 && i < 10 && j >= 0 && j < 10) return true;
            return false;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.close();
        }

    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author HossamDoma
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {

            int[][] maze = new int[10][10];

            for (int i = 0; i < 10; ++i) {
                String line = in.next();
                for (int j = 0; j < 10; ++j) {
                    maze[i][j] = line.charAt(j) == 'X' ? 1 : (line.charAt(j) == 'O' ? -1 : 0);
                }
            }

            boolean ok = false;

            //Horizontal
            for (int i = 0; i < 10; ++i) {

                int sum = 0;
                int cnt = 1;

                for (int j = 0; j < 10; ++j, cnt++) {

                    if (j >= 5) sum -= maze[i][j - 5];

                    sum += maze[i][j];

                    if (cnt >= 5 && sum >= 4) {
                        out.println("YES");
                        return;
                    }
                }
            }

            //Vertical
            for (int j = 0; j < 10; ++j) {

                int sum = 0;
                int cnt = 1;

                for (int i = 0; i < 10; ++i, cnt++) {

                    if (i >= 5) sum -= maze[i - 5][j];

                    sum += maze[i][j];

                    if (cnt >= 5 && sum >= 4) {
                        out.println("YES");
                        return;
                    }
                }
            }

            //Diagonal
            for (int i = 0; i + 5 <= 10; ++i) {

                int sum = 0;
                int j = 0;
                int cnt = 1;

                for (int k = i; k < 10; ++k, j++, cnt++) {

                    if (j >= 5) sum -= maze[k - 5][j - 5];

                    sum += maze[k][j];

                    if (cnt >= 5 && sum >= 4) {
                        out.println("YES");
                        return;
                    }
                }
            }

            for (int j = 0; j + 5 <= 10; ++j) {

                int sum = 0;
                int i = 0;
                int cnt = 1;

                for (int k = j; k < 10; ++k, i++, cnt++) {

                    if (i >= 5)
                        sum -= maze[i - 5][k - 5];

                    sum += maze[i][k];

                    if (cnt >= 5 && sum >= 4) {
                        out.println("YES");
                        return;
                    }
                }
            }

            //Anti-Diagonal
            for (int i = 0; i + 5 <= 10; ++i) {

                int sum = 0;
                int j = 9;
                int cnt = 1;

                for (int k = i; k < 10; ++k, j--, cnt++) {

                    if (j < 5)
                        sum -= maze[k - 5][j + 5];

                    sum += maze[k][j];

                    if (cnt >= 5 && sum >= 4) {
                        out.println("YES");
                        return;
                    }
                }
            }

            for (int j = 9; j - 4 >= 0; --j) {

                int sum = 0;
                int i = 0;
                int cnt = 1;

                for (int k = j; k >= 0; --k, i++, cnt++) {

                    if (i >= 5)
                        sum -= maze[i - 5][k + 5];

                    sum += maze[i][k];

                    if (cnt >= 5 && sum >= 4) {
                        out.println("YES");
                        return;
                    }
                }
            }

            out.println("NO");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public 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();
        }

    }
}

import java.util.*;

public class Darshjava
{
    public static void win (char [][] alice , int rowpos , int colpos , int xs  , int point , int direc , int lic )
    {
        int rowcpy = 0 , colcpy = 0 ;
        if (direc == 1)
        {
            rowcpy = rowpos-1 ; colcpy = colpos-1 ;
            if (xs == 4 && (point == 1 || lic == 1))
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy>=0 && colcpy >= 0)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ;
                 win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
            }
        }
        else if (direc == 2)
        {
            rowcpy = rowpos-1 ; colcpy = colpos ;
            if (xs == 4 && (point == 1 || lic == 1))
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy>=0)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ;  win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ;  win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
            }
        }
        else if (direc == 3)
        {
            rowcpy = rowpos-1 ; colcpy = colpos+1 ;
            if (xs == 4 && (point == 1 || lic == 1))
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy>=0 && colcpy < 10)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ;  win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ;  win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
            }
        }else if (direc == 4)
        {

            rowcpy = rowpos ; colcpy = colpos+1 ;
            if (xs == 4 && (point == 1 || lic == 1))
                {System.out.print("YES"); System.exit(0);}
            else if(colcpy < 10)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                {   xs++ ;  win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
                else if(alice[rowcpy][colcpy] == '.'&& point == 0)
                {   point++ ;  win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
            }
        }
        else if (direc == 5)
        {
            rowcpy = rowpos+1 ; colcpy = colpos+1 ;
            if (xs == 4 && (point == 1 || lic == 1))
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy < 10 && colcpy < 10)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ;  win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
            }
        }
        else if (direc == 6)
        {
            rowcpy = rowpos+1 ; colcpy = colpos ;
            if (xs == 4 && (point == 1 || lic == 1))
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy < 10)
            {

                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ;  win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ;  win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
            }
        }
        else if (direc == 7)
        {
            rowcpy = rowpos+1 ; colcpy = colpos-1 ;
            if (xs == 4 && (point == 1 || lic == 1))
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy < 10 && colcpy >=0 )
            {

                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ;  win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ;  win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
            }
        }
        else if (direc == 8)
        {
            rowcpy = rowpos ; colcpy = colpos-1 ;
            if (xs == 4 && (point == 1 || lic == 1))
                {System.out.print("YES"); System.exit(0);}
            else if(colcpy >= 0)
            {

                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ;  win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ;  win(alice , rowcpy , colcpy , xs , point , direc , lic) ;}
            }
        }

    }

    public static void main(String args [])
    {
        Scanner enter = new Scanner (System.in) ;
        char field[][] = new char [10] [10] ;
        int xs = 0 , point = 0 , lic = 0 ;
        for(int i = 0 ; i < 10 ; i++)
        {
            String row = enter.next() ;
            for(int j = 0 ; j < 10 ; j++)
                field [i][j] = row.charAt(j);
        }
        for(int i = 0 ; i < 10 ; i++)
            for(int j = 0 ; j < 10 ; j++)
                if(field[i][j] == 'X')
                    for(int k = 1 ; k < 8 ; k++)
                    {   lic = 0 ;
                        if (k == 1 && i+1 < 10 && j+1 < 10 && field[i+1][j+1] == '.')
                            lic = 1 ;
                        else if (k == 2 && i+1 < 10 && field[i+1][j] == '.')
                            lic = 1 ;
                        else if (k == 3 && i+1 < 10 && j-1 >= 0 && field[i+1][j-1] == '.')
                            lic = 1 ;
                        else if (k == 4 && j-1 >= 0 && field[i][j-1] == '.')
                            lic = 1 ;
                        else if (k == 5 && i-1 >= 0 && j-1 >= 0 && field[i-1][j-1] == '.')
                            lic = 1 ;
                        else if (k == 6 && i-1 >= 0 &&  field[i-1][j] == '.')
                            lic = 1 ;
                        else if (k == 7 && i-1 >= 0 && j+1 < 10 && field[i-1][j+1] == '.')
                            lic = 1 ;
                        else if (k == 8 && j+1 < 10 && field[i][j+1] == '.')
                            lic = 1 ;

                        win(field , i , j , 1 , point , k , lic );
                    }
        System.out.print("NO");
    }
}

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class q5 {

	public static void main(String[] args) throws IOException {

		Reader.init(System.in);
		PrintWriter out=new PrintWriter(System.out);
		StringBuffer output=new StringBuffer("");
		char[][] grid=new char[10][10];
		for(int i=0;i<10;i++) {
			grid[i]=Reader.next().toCharArray();
		}
		String ans="NO";
		for(int i=0;i<10;i++) {
			for(int j=0;j<10;j++) {
				if(grid[i][j]=='.') {
					int above=0,left=0,lud=0,rud=0;
					for(int k=j-1;k>=0;k--) {
						if(grid[i][k]=='X') left++;
						else break;
					}
					for(int k=j+1;k<10;k++) {
					if(grid[i][k]=='X') left++;
					else break;
					}
					for(int k=i-1;k>=0;k--) {
						if(grid[k][j]=='X') {
							above++;
						}
						else break;
					}
					for(int k=i+1;k<10;k++) {
						if(grid[k][j]=='X') {
							above++;
						}
						else break;
					}
					for(int k=i-1,l=j-1;k>=0 && l>=0;k--,l--) {
						if(grid[k][l]=='X') {
							lud++;
						}
						else break;
					}
					for(int k=i+1,l=j+1;k<10 && l<10;k++,l++) {
						if(grid[k][l]=='X') {
							lud++;
						}
						else break;
					}

					for(int k=i-1,l=j+1;k>=0 && l<10;k--,l++) {
						if(grid[k][l]=='X') {
							rud++;
						}
						else break;
					}
					for(int k=i+1,l=j-1;k<10 && l>=0;k++,l--) {
						if(grid[k][l]=='X') {
							rud++;
						}
						else break;
					}
					if(above>=4 || left>=4 || lud>=4 || rud>=4) ans="YES";

				}
			}
		}
		out.print(ans);
		out.flush();
	}
}

class NoD{
	int a, b;
	NoD(int aa,int bb){
		a=Math.min(aa, bb);b=Math.max(aa, bb);
	}
}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
    /** get next word */
    static String nextLine() throws IOException{
    	return reader.readLine();
    }
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }
    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}

/*
 * UMANG PANCHAL
 * DAIICT
 */

import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.util.Comparator;
public class Main
{

	private static final Comparator<? super Integer> Comparator = null;
	static LinkedList<Integer> adj[];
	static ArrayList<Integer> adj1[];
	static int[] color,visited1;
	static boolean b[],visited[],possible;
	static int level[];
	static Map<Integer,HashSet<Integer>> s;
	static int totalnodes,colored;
	static int count[];
	static long sum[];
	static int nodes;
	static long ans=0;
	static long[] as=new long[10001];
	static long c1=0,c2=0;
	static int[] a,d,k;
	static int max=100000000;
	static long MOD = 1000000007,sm=0,m=Long.MIN_VALUE;
	static boolean[] prime=new boolean[1000005];
	static int[] levl;
    static int[] eat;
    static int price[];
    static int res[],par[];
    static int result=0;
    static int[] root,size;
    static boolean yes = true;
    static long p=Long.MAX_VALUE;
	// --------------------My Code Starts Here----------------------

	public static void main(String[] args) throws IOException
	{
		in=new InputReader(System.in);
		w=new PrintWriter(System.out);

      char[][] c=new char[10][10];
      for(int i=0;i<10;i++)
      {
    	  String s=ns();
    	  for(int j=0;j<10;j++)
    	  {
    		  c[i][j]=s.charAt(j);
    	  }
      }
      boolean ans=false;
      for(int i=0;i<10;i++)
      {

    	  for(int j=0;j<=5;j++)
    	  {
    		  int x=0,d=0;
    		  for(int k=j;k<j+5;k++)
    		  {
    			  if(c[i][k]=='X')
        			  x++;
        		  else if(c[i][k]=='.')
        		      d++;
    		  }
    		  if(x==4 && d==1)
        	  {
        		  ans=true;
        		  break;
        	  }
    	  }
    	  if(ans==true)
    		  break;

      }
      if(ans==false)
      {
    	   for(int i=0;i<10;i++)
    	      {

    	    	  for(int j=0;j<=5;j++)
    	    	  {
    	    		  int x=0,d=0;
    	    		  for(int k=j;k<j+5;k++)
    	    		  {
    	    			  if(c[k][i]=='X')
    	        			  x++;
    	        		  else if(c[k][i]=='.')
    	        		      d++;
    	    		  }
    	    		  if(x==4 && d==1)
        	    	  {
        	    		  ans=true;
        	    		  break;
        	    	  }
    	    	  }
    	    	  if(ans==true)
    	    		  break;

    	      }
      }
	if(ans==false)
	{
		for(int i=0;i<10;i++)
		{
			for(int j=0;j<10;j++)
			{
				int x=0,d=0;
					int k=0;
					while(i+k<10 && j+k<10 && k<5)
					{
						 if(c[i+k][j+k]=='X')
   	        			  x++;
   	        		  else if(c[i+k][j+k]=='.')
   	        		      d++;
						 k++;
					}
					if(x==4 && d==1)
					{
						ans=true;
						break;
					}
					//if(i==0 && j==0)
						//w.println(x+" "+d);
			}
			if(ans==true)
				break;
		}
	}
	if(ans==false)
	{
		for(int i=0;i<10;i++)
		{
			for(int j=0;j<10;j++)
			{
				int x=0,d=0;
					int k=0;
					while(i+k<10 && j-k>=0 && k<5)
					{
						 if(c[i+k][j-k]=='X')
   	        			  x++;
   	        		  else if(c[i+k][j-k]=='.')
   	        		      d++;
						 k++;
					}
					if(x==4 && d==1)
					{
						ans=true;
						break;
					}
					//if(i==0 && j==4)
						//w.println(x+" "+d);
			}
			if(ans==true)
				break;
		}
	}
      if(ans==false)
    	  w.print("No");
      else
    	  w.print("Yes");
	    w.close();
    }

	// --------------------My Code Ends Here------------------------

	public static long dfs(int i)
	{

	    long min=a[i];
		visited[i]=true;
		for(int j=0;j<adj[i].size();j++)
		{
			if(!visited[adj[i].get(j)])
			{
				min=Math.min(min,dfs(adj[i].get(j)));
			}
		}
	  return min;
	}
	public static void pa(int[] a)
	{
		for(int i=0;i<a.length;i++)
			w.print(a[i]+" ");
		w.println();
	}
	public static void bfs(int i)
	{

	  Queue<Integer> q=new LinkedList<Integer>();
	 q.add(i);

	 level[i]=1;
	 while(!q.isEmpty())
	 {
		 int d=q.poll();
		 for(int j=0;j<adj[d].size();j++)
		 {
			 int x=adj[d].get(j);
			 level[x]=level[d]+1;
			 q.add(x);
		 }

	 }

	}

	 public static void buildgraph(int n)
	 {
         adj=new LinkedList[n];
         visited=new boolean[n];
         level=new int[n];
         par=new int[n];
         for(int i=0;i<n;i++)
         	{
        	 adj[i]=new LinkedList<Integer>();

         	}

	 }

	/*public static long kruskal(Pair[] p)
	{
		long ans=0;
		int w=0,x=0,y=0;
		for(int i=0;i<p.length;i++)
		{
			w=p[i].w;
			x=p[i].x;
			y=p[i].y;
			if(root(x)!=root(y))
			{
				ans+=w;
				union(x,y);
			}
		}
		return ans;
	}*/

	 static class Pair implements Comparable<Pair>
	 {
		Integer x,y;

		Pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}
		public int compareTo(Pair o)
		{
		  return y-o.y;

		}

	}

	  public static  long maxSubArraySum(int a[], int size)
      {
         long max_so_far = a[0];
         long curr_max = a[0];

         for (int i = 1; i < size; i++)
         {
              curr_max = Math.max(a[i], curr_max+a[i]);
              max_so_far = Math.max(max_so_far, curr_max);
         }
         return max_so_far;
      }

	public static int root(int i)
	{
		while(root[i]!=i)
		{
			root[i]=root[root[i]];
			i=root[i];
		}
		return i;
	}

	public static void init(int n)
	{
		root=new int[n+1];
		for(int i=1;i<=n;i++)
			root[i]=i;
	}
	public static void union(int a,int b)
	{
	    int root_a=root(a);
	    int root_b=root(b);
	    root[root_a]=root_b;
	   // size[root_b]+=size[root_a];
	}

	public static long nCrModp(long n, long r, long p)
	{

	    long[] C=new long[(int)r+1];

	    C[0] = 1;

	    for (long i = 1; i <= n; i++)
	    {

	        for (long j = Math.min(i, r); j > 0; j--)

	            C[(int)j] = (C[(int)j] + C[(int)(j-1)])%p;
	    }
	    return C[(int)r];
	}
	public static long nCr(long n, long r)
	{
		long x=1;
		for(long i=n;i>=n-r+1;i--)
			x=((x)*(i));
		for(long i=r;i>=1;i--)
			x=((x)/(i));

		return x%MOD;
	}
	public static long nCrModpDP(long n, long r, long p)
	{

	    long[] C=new long[(int)r+1];

	    C[0] = 1;

	    for (long i = 1; i <= n; i++)
	    {
	        for (int j = (int)Math.min(i, r); j > 0; j--)
	           C[j] = (C[j] + C[j-1])%p;
	    }
	    return C[(int)r];
	}

	public static long nCrModpLucas(long n,long r, long p)
	{

	   if (r==0)
	      return 1;

	   long ni = n%p, ri = r%p;

	   return (nCrModpLucas(n/p,r/p, p) * nCrModpDP(ni,ri, p)) % p;
	}

	public static int getSum(long BITree[], int index)
	{
	    int sum = 0;

	    while (index > 0)
	    {
	        sum += BITree[index];
	        index -= index & (-index);
	    }
	    return sum;
	}

	public static long[] updateBIT(long BITree[], int n, int index, int val)
	{
	    while (index <= n)
	    {
	       BITree[index] += val;
	       index += index & (-index);
	    }
	    return BITree;
	}

	public static boolean isPrime(int n)
	{
	    // Corner cases
	    if (n <= 1)  return false;
	    if (n <= 3)  return true;

	    // This is checked so that we can skip
	    // middle five numbers in below loop
	    if (n%2 == 0 || n%3 == 0)
	    	return false;

	    for (int i=5; i*i<=n; i=i+6)
	        if (n%i == 0 || n%(i+2) == 0)
	           return false;

	    return true;
	}

	public static String ns()
	{
		return in.nextLine();
	}
	public static int ni()
	{
		return in.nextInt();
	}
	public static long nl()
	{
		return in.nextLong();
	}
	public static int[] na(int n)
	{
		a=new int[n];
		for(int i=0;i<n;i++)
		a[i]=ni();
		return a;
	}
	public static void sieveOfEratosthenes()
	    {
	       int n=prime.length;
	        for(int i=0;i<n;i++)
	            prime[i] = true;

	        for(int p = 2; p*p <=n; p++)
	        {
	            if(prime[p] == true)
	            {
	                for(int i = p*2; i <n; i += p)
	                    prime[i] = false;
	            }
	        }
	    }

	public static boolean printDivisors(long n)
    {
		long ans=0;
        for (int i=1; i<=Math.sqrt(n); i++)
        {
            if (n%i==0)
            {
                if (n/i == i)
                    ans++;
                else
                {
                	ans=ans+2;
                }
            }
            if(ans>3)
            	break;
        }
        if(ans==3)
        	return true;
        else
        	return false;
    }

  public static String rev(String s)
	{
		StringBuilder sb=new StringBuilder(s);
		sb.reverse();
		return sb.toString();
	}
	static long lcm(long a, long b)
	{
	    return a * (b / gcd(a, b));
	}
	static long gcd(long a, long b)
	{
	    while (b > 0)
	    {
	        long temp = b;
	        b = a % b; // % is remainder
	        a = temp;
	    }
	    return a;
	}
	static InputReader in;
	static PrintWriter w;
static class InputReader
{

private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
private SpaceCharFilter filter;

public InputReader(InputStream stream)
{
  this.stream = stream;
}

public int snext()
{
  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 nextInt()
{
  int c = snext();
  while (isSpaceChar(c))
  {
    c = snext();
  }
  int sgn = 1;
  if (c == '-')
  {
    sgn = -1;
    c = snext();
  }
  int res = 0;
  do
  {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = snext();
  }
  while (!isSpaceChar(c));
  return res * sgn;
}

public long nextLong()
{
  int c = snext();
  while (isSpaceChar(c))
  {
    c = snext();
  }
  int sgn = 1;
  if (c == '-')
  {
    sgn = -1;
    c = snext();
  }
  long res = 0;
  do
  {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = snext();
  }
  while (!isSpaceChar(c));
  return res * sgn;
}
public String readString()
{
  int c = snext();
  while (isSpaceChar(c))
  {
    c = snext();
  }
  StringBuilder res = new StringBuilder();
  do
  {
    res.appendCodePoint(c);
    c = snext();
  }
  while (!isSpaceChar(c));
  return res.toString();
}

public String nextLine()
{
  int c = snext();
  while (isSpaceChar(c))
    c = snext();
  StringBuilder res = new StringBuilder();
  do
  {
    res.appendCodePoint(c);
    c = snext();
  }
  while (!isEndOfLine(c));
  return res.toString();
}

public boolean isSpaceChar(int c)
{
  if (filter != null)
    return filter.isSpaceChar(c);
  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}

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

public interface SpaceCharFilter
{
  public boolean isSpaceChar(int ch);
}
}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author sys_coder
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            char[][] arr = new char[10][10];
            for (int i = 0; i < 10; i++) {
                arr[i] = in.nextString().toCharArray();
            }
            int dx[] = {0, 1, -1, 1};
            int dy[] = {1, 0, 1, 1};
            for (int i = 0; i < 10; i++) {
                boolean flag = false;
                for (int j = 0; j < 10; j++) {
                    if (arr[i][j] == '.') {
                        arr[i][j] = 'X';
                        for (int k = 0; k < dx.length; k++) {
                            flag = check(i, j, arr, dx[k], dy[k]);
                            if (flag) {
                                out.print("YES");
                                return;
                            }
                        }
                        arr[i][j] = '.';
                    }

                }

            }

            out.print("NO");
        }

        private boolean check(int i, int j, char[][] arr, int xx, int yy) {
            for (int k = 0; k < 5; k++) {
                int count = 0;
                for (int l = -4 + k, ll = 0; ll < 5 && l < 5; ll++, l++) {
                    if (valid(i + l * xx, j + l * yy) && arr[i + l * xx][j + l * yy] == 'X') {
                        count++;
                    }
                }
                if (count == 5) return true;

            }
            return false;
        }

        private boolean valid(int k, int l) {
            if (k < 0 || k > 9 || l < 0 || l > 9) return false;
            return true;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.close();
        }

    }
}

import java.io.* ;
import java.util.* ;
import java.util.stream.* ;
import java.text.* ;
import java.math.* ;
public class Codeshefcode{
	public static void main(String[] args) throws IOException{
		Solver Machine = new Solver() ;
		Machine.Solve() ;
		Machine.Finish();
	}
}
class Mod{
	static long mod=1000000007 ;
	static long d(long a,long b){ return (a*MI(b))%mod ; }
	static long m(long a , long b){ return (a*b)%mod ; }
	static private long MI(long a ){ return pow(a,mod-2) ; }
	static long pow(long a,long b){
		if(b<0) return pow(MI(a),-b) ;
		long val=a ; long ans=1 ;
		while(b!=0){
			if((b&1)==1) ans = (ans*val)%mod ;
			val = (val*val)%mod ;
			b>>=1 ;
		}
		return ans ;
	}
}
class pair implements Comparable<pair>{
	int x ; int y ;
	pair(int x,int y){ this.x=x ; this.y=y ;}
	public int compareTo(pair p){
		return (this.x<p.x ? -1 : (this.x>p.x ? 1 : (this.y<p.y ? -1 : (this.y>p.y ? 1 : 0)))) ;
	}
}
class Solver{
	FasterScanner ip = new FasterScanner(System.in) ;
	PrintWriter op = new PrintWriter(System.out) ;
	int mat[][] = new int[10][10] ;
	void Solve() throws IOException{
		for(int i=0 ; i<10 ; i++){
			char c[] = ip.S().toCharArray() ;
			for(int j=0 ; j<10 ; j++) mat[i][j] = (c[j]=='X' ? 1 : (c[j]=='.' ? 0 : -1)) ;
		}
		boolean flag=false ;
		for(int i=0 ; i<10 ; i++)
			for(int j=0 ; j<10 ; j++){
				if(mat[i][j]!=0) continue ;
				mat[i][j]=1 ;
				mylist ls[] = new mylist[4] ;
				for(int k=0 ; k<4 ; k++) ls[k] = new mylist() ;
				for(int k=0 ; k<10 ; k++) ls[0].add(mat[k][j]) ;
				for(int k=0 ; k<10 ; k++) ls[1].add(mat[i][k]) ;
				int mn = Integer.min(i,j) ;
				int x = i-mn , y = j-mn ;
				for(int k=0 ; x+k<10 && y+k<10 ; k++) ls[2].add(mat[x+k][y+k]) ;
				x=i ; y=j ;
				while(0<x && y<9){x-- ; y++ ;}
				for(int k=0 ; 0<=(x+k) && (x+k)<=9 && 0<=(y-k) && (y-k)<=9 ; k++) ls[3].add(mat[x+k][y-k]) ;
				for(int k=0 ; k<4 ; k++) if(checklist(ls[k])) flag=true ;
				mat[i][j]=0 ;
			}
		pln(flag ? "YES" : "NO") ;
	}
	boolean checklist(mylist lst){
		int ct=0 ;
		for(int elem : lst){
			if(elem!=1) ct=0 ;
			else{
				ct++ ;
				if(ct==5) return true ;
			}
		}
		return false ;
	}
	void p(Object o){
		op.print(o) ;
	}
	void pln(Object o){
		op.println(o) ;
	}
	void pArr(String name,Object arr,char type,int st){
		p(name+": [") ;
		if(type=='i'){
			int arr1[] = (int[]) arr ;
			for(int i=st ; i<arr1.length ; i++) p(arr1[i]+(i+1==arr1.length ? "" : ",")) ;
		}else if(type=='l'){
			long arr1[] = (long[]) arr ;
			for(int i=st ; i<arr1.length ; i++) p(arr1[i]+(i+1==arr1.length ? "" : ",")) ;
		}else if(type=='b'){
			boolean arr1[] = (boolean[]) arr ;
			for(int i=0 ; i<arr1.length ; i++) p((arr1[i] ? 1 : 0)+(i+1==arr1.length ? "" : ",")) ;
		}
		pln("]") ;
	}
	void Finish(){
		op.flush();
		op.close();
	}
}
@SuppressWarnings("serial")
class mylist extends ArrayList<Integer>{
}
@SuppressWarnings("serial")
class myset extends TreeSet<Long>{
}
@SuppressWarnings("serial")
class mystack extends Stack<Integer>{
}
@SuppressWarnings("serial")
class mymap extends TreeMap<Long,Integer>{
}
class FasterScanner {
	private InputStream mIs;
	private byte[] buf = new byte[1024];
	private int curChar,numChars;
	public FasterScanner() { this(System.in); }
	public FasterScanner(InputStream is) { mIs = is;}
	public int read() {
		if (numChars == -1) throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}
			if (numChars <= 0) return -1;
		}
		return buf[curChar++];
	}
	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 String S(){
		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 long l(){
		int c = read();
		while (isSpaceChar(c)) c = read();
		int sgn = 1;
		if (c == '-') { sgn = -1 ; c = read() ; }
		long res = 0;
		do{
			if (c < '0' || c > '9') throw new InputMismatchException();
			res *= 10 ; res += c - '0' ; c = read();
		}while(!isSpaceChar(c));
		return res * sgn;
	}
	public int i(){
		int c = read() ;
		while (isSpaceChar(c)) c = read();
		int sgn = 1;
		if (c == '-') { sgn = -1 ; c = read() ; }
		int res = 0;
		do{
			if (c < '0' || c > '9') throw new InputMismatchException();
		res *= 10 ; res += c - '0' ; c = read() ;
		}while(!isSpaceChar(c));
		return res * sgn;
	}
	public int[] ia(int n){
		int a[] = new int[n] ;
		for(int i=0 ; i<n ; i++) a[i] = i() ;
		return a ;
	}
	public long[] la(int n){
		long a[] = new long[n] ;
		for(int i=0 ; i<n ; i++) a[i] = l() ;
		return a ;
	}
	public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
	public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
}

import java.util.Scanner;

public class TestJava{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String arr[]=new String[10];
        int i,j;
        for(i=0;i<10;i++){
            arr[i]=sc.nextLine();
        }
        String ver[]=new String[10];
        for(i=0;i<10;i++){
            StringBuilder sb=new StringBuilder();
            for(j=0;j<10;j++){
                sb.append(arr[j].charAt(i));
            }
            ver[i]=sb.toString();
        }

        for(i=0;i<10;i++){
            String temp=arr[i];
            if(temp.contains("XX.XX")){
                System.out.println("YES");
                return;
        }
        if(temp.contains("XXXX.")){
            System.out.println("YES");
            return ;
        }
        if(temp.contains(".XXXX")){
            System.out.println("YES");
            return;
        }
        if(temp.contains("X.XXX")) {System.out.println("YES"); return ;}
        if(temp.contains("XXX.X")) {System.out.println("YES"); return ;}

           temp=ver[i];
            if(temp.contains("XX.XX")){
                System.out.println("YES");
                return;
        }
        if(temp.contains("XXXX.")){
            System.out.println("YES");
            return ;
        }
        if(temp.contains(".XXXX")){
            System.out.println("YES");
            return;
        }
        if(temp.contains("X.XXX")) {System.out.println("YES"); return ;}
        if(temp.contains("XXX.X")) {System.out.println("YES"); return ;}

        }

        for(i=0;i<10;i++){
            for(j=0;j<10;j++){
                if(arr[i].charAt(j)=='X' && checkvertical(arr,i,j)) {
                    System.out.println("YES");
                    return;
                }
            }
        }

        System.out.println("NO");
    }

    private static boolean checkvertical(String[] arr, int i, int j) {

        StringBuilder sb=new StringBuilder();
        int x=i;
        int y=j;
        while(x<10 && y<10){
            sb.append(arr[x].charAt(y));
            x++;
            y++;
        }
        x=i-1;
        y=j-1;
        while(x>=0 && y>=0){
            sb.insert(0, arr[x].charAt(y));
            x--;
            y--;
        }
        String temp=sb.toString();

        if(temp.contains("XX.XX")){
            return true;
        }
        if(temp.contains("XXXX.")){
            return true;
        }
        if(temp.contains(".XXXX")){
            return true;
        }
        if(temp.contains("X.XXX")) return true;
        if(temp.contains("XXX.X")) return true;

        sb=new StringBuilder();

         x=i;
        y=j;
        while(x<10 && y>=0){
            sb.append(arr[x].charAt(y));
            x++;
            y--;
        }
        x=i-1;
        y=j+1;
        while(x>=0 && y<10){
            sb.insert(0, arr[x].charAt(y));
            x--;
            y++;
        }

         temp=sb.toString();
        if(temp.contains("XX.XX")){
            return true;
        }
        if(temp.contains("XXXX.")){
            return true;
        }
        if(temp.contains(".XXXX")){
            return true;
        }
        if(temp.contains("X.XXX")) return true;
        if(temp.contains("XXX.X")) return true;

       return false;
    }

}

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;

public class Main {
	static class ReaderForJava{

	    final private int BUFFER_SIZE = 1 << 16;
	    private DataInputStream din;
	    private byte[] buffer;
	    private int bufferPointer, bytesRead;

	    public ReaderForJava()
	    {
	        din = new DataInputStream(System.in);
	        buffer = new byte[BUFFER_SIZE];
	        bufferPointer = bytesRead = 0;
	    }

	    public ReaderForJava(String file_name) throws IOException
	    {
	        din = new DataInputStream(new FileInputStream(file_name));
	        buffer = new byte[BUFFER_SIZE];
	        bufferPointer = bytesRead = 0;
	    }

	    public String readLine() throws IOException
	    {
	        byte[] buf = new byte[64]; // line length
	        int cnt = 0, c;
	        while ((c = read()) != -1)
	        {
	        	if (c == '\n')
	                    break;
	        	buf[cnt++] = (byte) c;
	        }
	        return new String(buf, 0, cnt);
	    }

	    public int nextInt() throws IOException
	    {
	        int ret = 0;
	        byte c = read();
	        while (c <= ' ')
	        	c = read();
	        boolean neg = (c == '-');
	        if (neg)
	        	c = read();
	        do
	        {
	        	ret = ret * 10 + c - '0';
	        }  while ((c = read()) >= '0' && c <= '9');

	        if (neg)
	            return -ret;
	        return ret;
	    }

	    public long nextLong() throws IOException
	    {
	        long ret = 0;
	        byte c = read();
	        while (c <= ' ')
	        	c = read();
	        boolean neg = (c == '-');
	        if (neg)
	        	c = read();
	        do {
	        	ret = ret * 10 + c - '0';
	        }
	        while ((c = read()) >= '0' && c <= '9');
	        if (neg)
	            return -ret;
	        return ret;
	    }

	    public double nextDouble() throws IOException
	    {
	        double ret = 0, div = 1;
	        byte c = read();
	        while (c <= ' ')
	        	c = read();
	        boolean neg = (c == '-');
	        if (neg)
	            c = read();

	        do {
	            ret = ret * 10 + c - '0';
	        }
	        while ((c = read()) >= '0' && c <= '9');

	        if (c == '.')
	        {
	        	while ((c = read()) >= '0' && c <= '9')
	        	{
	        		ret += (c - '0') / (div *= 10);
	            }
	        }

	        if (neg)
	            return -ret;
	        return ret;
	    }

	    private void fillBuffer() throws IOException
	    {
	        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
	        if (bytesRead == -1)
	            buffer[0] = -1;
	    }

	    private byte read() throws IOException
	    {
	        if (bufferPointer == bytesRead)
	            fillBuffer();
	        return buffer[bufferPointer++];
	    }

	    public void close() throws IOException
	    {
	        if (din == null)
	            return;
	        din.close();
	    }
	}
	static class Pair{
		public int first;
		public int second;
		public Pair(int first, int second) {
			this.first = first;
			this.second = second;
		}
	}
	static boolean foundResult = false;
	static int length = 10;
	static void generatePossibleWin(int [][] matrix, int [][] visited, int currentX, int currentY, int currentMovement, int currentCost, String direction) {
		if (currentCost > 1) {
			return;
		}
		if (foundResult) {
			return;
		}
		if (currentMovement == 5) {
			foundResult = true;
			return;
		}

		if (visited[currentX][currentY] != 1) {
			visited[currentX][currentY] = 1;
			if (direction.equals("UP")) {
				if (currentX > 0) {
					if (matrix[currentX - 1][currentY] != -1) {
						if (matrix[currentX -1][currentY] == 1) {
							generatePossibleWin(matrix, visited, currentX - 1, currentY, currentMovement + 1, currentCost, direction);
						} else {
							generatePossibleWin(matrix, visited, currentX - 1, currentY, currentMovement + 1, currentCost + 1, direction);
						}
					}
				}
			} else if (direction.equals("DOWN")) {
				if (currentX < length - 1) {
					if (matrix[currentX + 1][currentY] != -1) {
						if (matrix[currentX + 1][currentY] == 1) {
							generatePossibleWin(matrix, visited, currentX + 1, currentY, currentMovement + 1, currentCost, direction);
						} else {
							generatePossibleWin(matrix, visited, currentX + 1, currentY, currentMovement + 1, currentCost + 1, direction);
						}
					}
				}
			} else if (direction.equals("LEFT")) {
				if (currentY > 0) {
					if (matrix[currentX][currentY - 1] != -1) {
						if (matrix[currentX][currentY - 1] == 1) {
							generatePossibleWin(matrix, visited, currentX, currentY - 1, currentMovement + 1, currentCost, direction);
						} else {
							generatePossibleWin(matrix, visited, currentX, currentY - 1, currentMovement + 1, currentCost + 1, direction);
						}
					}
				}
			} else if (direction.equals("RIGHT")) {
				if (currentY < length - 1) {
					if (matrix[currentX][currentY + 1] != -1) {
						if (matrix[currentX][currentY + 1] == 1) {
							generatePossibleWin(matrix, visited, currentX, currentY + 1, currentMovement + 1, currentCost, direction);
						} else {
							generatePossibleWin(matrix, visited, currentX, currentY + 1, currentMovement + 1, currentCost + 1, direction);
						}
					}
				}
			} else if (direction.equals("DIAGONAL_LEFT_UP")) {
				if (currentX > 0 && currentY > 0) {
					if (matrix[currentX - 1][currentY - 1] != -1) {
						if (matrix[currentX - 1][currentY - 1] == 1) {
							generatePossibleWin(matrix, visited, currentX - 1, currentY - 1, currentMovement + 1, currentCost, direction);
						} else {
							generatePossibleWin(matrix, visited, currentX - 1, currentY - 1, currentMovement + 1, currentCost + 1, direction);
						}
					}
				}
			} else if (direction.equals("DIAGONAL_LEFT_DOWN")) {
				if (currentX < length - 1 && currentY > 0) {
					if (matrix[currentX + 1][currentY - 1] != -1) {
						if (matrix[currentX + 1][currentY - 1] == 1) {
							generatePossibleWin(matrix, visited, currentX + 1, currentY - 1, currentMovement + 1, currentCost, direction);
						} else {
							generatePossibleWin(matrix, visited, currentX + 1, currentY - 1, currentMovement + 1, currentCost + 1, direction);
						}
					}
				}
			} else if (direction.equals("DIAGONAL_RIGHT_UP")) {
				if (currentX > 0 && currentY < length - 1) {
					if (matrix[currentX - 1][currentY + 1] != -1) {
						if (matrix[currentX - 1][currentY + 1] == 1) {
							generatePossibleWin(matrix, visited, currentX - 1, currentY + 1, currentMovement + 1, currentCost, direction);
						} else {
							generatePossibleWin(matrix, visited, currentX - 1, currentY + 1, currentMovement + 1, currentCost + 1, direction);
						}
					}
				}
			} else if (direction.equals("DIAGONAL_RIGHT_DOWN")) {
				if (currentX < length - 1 && currentY < length - 1) {
					if (matrix[currentX + 1][currentY + 1] != -1) {
						if (matrix[currentX + 1][currentY + 1] == 1) {
							generatePossibleWin(matrix, visited, currentX + 1, currentY + 1, currentMovement + 1, currentCost, direction);
						} else {
							generatePossibleWin(matrix, visited, currentX + 1, currentY + 1, currentMovement + 1, currentCost + 1, direction);
						}
					}
				}
			}
		}
	}

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		int matrix[][] = new int [length][length];
		ReaderForJava reader = new ReaderForJava();
		int XCounter = 0;
		int startingX = -1;
		int startingY = -1;
		List <Pair> XPositions = new LinkedList<>();
		for (int i = 0; i < length; i++) {
			String line = reader.readLine().replace("\r", "");
			char[] lineAsChar = line.toCharArray();
			for (int j = 0; j < length; j++) {
				char currentChar= lineAsChar[j];
				if (currentChar == 'X') {
					if (startingX == -1) {
						startingX = i;
						startingY = j;
					}
					Pair currentPair = new Pair(i,j);
					XPositions.add(currentPair);
					matrix[i][j] = 1;
					XCounter++;
				} else if (currentChar == 'O') {
					matrix[i][j] = -1;
				}
			}
		}
		if (XCounter < 4) {
			System.out.println("NO");
			return;
		}

		int currentX = XPositions.size();
		for (int i = 0; i < currentX; i++) {
			Pair currentPair = XPositions.get(i);
			int [][]visited = new int[length][length];
			if (!foundResult) {
				generatePossibleWin(matrix, visited, currentPair.first, currentPair.second, 1, 0,"LEFT");
			}
			if (!foundResult) {
				visited = new int[length][length];
				generatePossibleWin(matrix, visited, currentPair.first, currentPair.second, 1, 0,"RIGHT");
			}
			if (!foundResult) {
				visited = new int[length][length];
				generatePossibleWin(matrix, visited, currentPair.first, currentPair.second, 1, 0,"UP");
			}
			if (!foundResult) {
				visited = new int[length][length];
				generatePossibleWin(matrix, visited, currentPair.first, currentPair.second, 1, 0,"DOWN");
			}
			if (!foundResult) {
				visited = new int[length][length];
				generatePossibleWin(matrix, visited, currentPair.first, currentPair.second, 1, 0,"DIAGONAL_LEFT_UP");
			}
			if (!foundResult) {
				visited = new int[length][length];
				generatePossibleWin(matrix, visited, currentPair.first, currentPair.second, 1, 0,"DIAGONAL_LEFT_DOWN");
			}
			if (!foundResult) {
				visited = new int[length][length];
				generatePossibleWin(matrix, visited, currentPair.first, currentPair.second, 1, 0,"DIAGONAL_RIGHT_UP");
			}
			if (!foundResult) {
				visited = new int[length][length];
				generatePossibleWin(matrix, visited, currentPair.first, currentPair.second, 1, 0,"DIAGONAL_RIGHT_DOWN");
			}
			if (foundResult){
				break;
			}
		}
		if (!foundResult) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}

	}
}

// 1511790129440

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class BinaryProb {
	public static PrintWriter out;

	   //-----------MyScanner class for faster input----------
	   public static class MyScanner {
	      BufferedReader br;
	      StringTokenizer st;

	      public MyScanner() {
	         br = new BufferedReader(new InputStreamReader(System.in));
	      }

	      String next() {
	          while (st == null || !st.hasMoreElements()) {
	              try {
	                  st = new StringTokenizer(br.readLine());
	              } catch (IOException e) {
	                  e.printStackTrace();
	              }
	          }
	          return st.nextToken();
	      }

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

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

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

	      String nextLine(){
	          String str = "";
		  try {
		     str = br.readLine();
		  } catch (IOException e) {
		     e.printStackTrace();
		  }
		  return str;
	      }

	   }
	   public static void main(String args[]) throws Exception {

			class prob {
				int calcd(String[] in, int i, int j) {
					int count = 0;
					int left = i - 1;
					int right = j - 1;
					while (left >= 0 && right >= 0) {
						if (in[left].charAt(right) != 'X') {
							break;
						}
						++count;
						--left;
						--right;
					}

					int left2 = i + 1;
					int right2 = j + 1;
					while (left2 < 10 && right2 < 10) {
						if (in[left2].charAt(right2) != 'X') {
							break;
						}
						++count;
						++left2;
						++right2;
					}

					int count2 = 0;
					left = i - 1;
					right = j + 1;
					while (left >= 0 && right < 10) {
						if (in[left].charAt(right) != 'X') {
							break;
						}
						++count2;
						--left;
						++right;
					}

					left2 = i + 1;
					right2 = j - 1;
					while (left2 < 10 && right2 >= 0) {
						if (in[left2].charAt(right2) != 'X') {
							break;
						}
						++count2;
						++left2;
						--right2;
					}
					return Math.max(count, count2);
				}
				int calc(String[] in, int i, int j) {
					int count = 0;
					int left = j - 1;
					int right = j + 1;
					while (left >= 0) {
						if (in[i].charAt(left) != 'X') {
							break;
						}
						++count;
						--left;
					}
					while (right < 10) {
						if (in[i].charAt(right) != 'X') {
							break;
						}

						++count;
						++right;
					}

					int count2 = 0;
					int top = i - 1;
					int bottom = i + 1;
					while (top >= 0) {
						if (in[top].charAt(j) != 'X') {
							break;
						}
						++count2;
						--top;
					}
					while (bottom < 10) {
						if (in[bottom].charAt(j) != 'X') {
							break;
						}

						++count2;
						++bottom;
					}

					return Math.max(count, count2);
				}
				public void solve() {
					MyScanner s = new MyScanner();
					String[] in = new String[10];
					for (int i = 0;i < 10; ++i) {
						in[i] = s.next();
					}
					for (int i = 0; i < 10; ++i) {
						for (int j = 0; j < 10; ++j) {
							if (in[i].charAt(j) == '.') {
								if (calc(in, i, j) >= 4 || calcd(in, i, j) >= 4) {
									System.out.print("YES");
									return;
								}
							}
						}
					}

					System.out.print("NO");

				}
			}
			prob s = new prob();
			s.solve();
		}
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {

        File file = new File("in.txt");
        File fileOut = new File("out.txt");
        InputStream inputStream = null;
        OutputStream outputStream = null;
        // try {inputStream= new FileInputStream(file);} catch (FileNotFoundException ex){return;};
//        try {outputStream= new FileOutputStream(fileOut);} catch (FileNotFoundException ex){return;};
        inputStream = System.in;
        outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

}

class TaskB {
    private List<String> matrix;
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        matrix = new ArrayList<>();
        for(int i=0; i<10; i++){
            matrix.add(in.next());
        }
        for(int i=0; i<10; i++){
            if(canWin(matrix.get(i))){
                out.println("YES");
                return;
            }
        }
        for(int i=0; i<10; i++){
            StringBuilder sb = new StringBuilder();
            for(int j=0; j<10; j++){
                sb.append(matrix.get(j).charAt(i));
            }
            if(canWin(sb.toString())){
                out.println("YES");
                return;
            }
        }

        for(int i=0; i<10; i++){
            String s = mainDiagonal(0,i);
            if(canWin(s)){
                out.println("YES");
                return;
            }
        }
        for(int j=1; j<10; j++){
            String s  = mainDiagonal(j,0);
            if(canWin(s)){
                out.println("YES");
                return;
            }
        }

        for(int i=0; i<10; i++){
            String s = minorDiagonal(i,0);
            if(canWin(s)){
                out.println("YES");
                return;
            }
        }

        for(int j=1; j<10; j++){
            String s = minorDiagonal(9,j);
            if(canWin(s)){
                out.println("YES");
                return;
            }
        }
        out.println("NO");

    }

    public String mainDiagonal(Integer minY, Integer minX){
        StringBuilder sb = new StringBuilder();
        while(minY<10 & minX < 10){
            sb.append(matrix.get(minY).charAt(minX));
            minY++;
            minX++;
        }
        return sb.toString();
    }

    public String minorDiagonal(Integer maxY, Integer minX){
        StringBuilder sb =  new StringBuilder();
        while(maxY>=0 && minX<10){
            sb.append(matrix.get(maxY).charAt(minX));
            maxY--;
            minX++;
        }
        return sb.toString();
    }

    public Boolean canWin(String seq){
        Integer crossedNeeded = 0;
        Integer validSeq = 0;
        Integer maxValid = Integer.MIN_VALUE;
        Integer lastCross = null;
        for(int i=0; i<seq.length(); i++){
            if(seq.charAt(i)=='X'){
                validSeq++;
                maxValid = Math.max(maxValid, validSeq);
            }
            else if(seq.charAt(i) == 'O'){
                validSeq=0;
                crossedNeeded=0;
            }
            else {
                if(crossedNeeded==0){
                    crossedNeeded++;
                    lastCross = i;
                    validSeq++;
                    maxValid = Math.max(maxValid, validSeq);
                }
                else{
                    validSeq = (i-lastCross);
                    lastCross = i;
                }
            }
        }
        if(maxValid>=5){
            return Boolean.TRUE;
        }
        return Boolean.FALSE;

    }

}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public 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 String nextLine(){
        try {
            return reader.readLine();
        } catch (IOException e){
            throw new RuntimeException(e);
        }
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() { return Long.parseLong(next()); }

}

class Pair<F, S> {
    public final F first;
    public final S second;

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

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof Pair)) {
            return false;
        }
        Pair<?, ?> p = (Pair<?, ?>) o;
        return Objects.equals(p.first, first) && Objects.equals(p.second, second);
    }

    @Override
    public int hashCode() {
        return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode());
    }

    @Override
    public String toString() {
        return "(" + first + ", " + second + ')';
    }
}

import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
import java.text.*;
/*
 * @IO : BufferedReader, InputStreamReader, IOException.
 * @Util : Scanner, Arrays, ArrayList, StringTokenizer, TreeSet.
 * @Util : Collections, HashMap, HashSet.
 * @Lang : StringBuilder, StringBuffer.
 * @Math : BigInteger, BigDecimal.
 * @Text : DecimalFormat.
 * @System : System.currentTimeMillis(); , System.nanoTime();
 * @Custom I/O : new PrintWriter(new BufferedOutputStream(System.out))
 */

public class Main{

	// Custom I/O Routine
	public static PrintWriter out = new PrintWriter(System.out);
	public static Reader in = new Reader();

	// Intializations of Values
	static byte UNCAL = -1;
	static int INF = (int) 1e6;

	// Intializations of Data Structures & Graphs

	public static void main(String[] args) throws IOException{

		//---------------------Solution Start---------------------//
		char[][] grid = new char[10][10];
		for (int i = 0; i < 10; i++)
		{
			grid[i] = in.nextLine().toCharArray();
		}

		int[] dx = {1,0,1,1};
		int[] dy = {0,1,1,-1};

		boolean win = false;

		out : for (int shift = 0 ; shift < 4 ; shift++){
				for (int row = 0 ; row + dx[shift] * 4 < 10 ; row++){
					for (int column = 0 ; column < 10 && column + dy[shift] * 4 < 10 ; column++){
						if (0 <= column + dy[shift] * 4){

							int Xs = 0, dot = 0;
							for (int count = 0 ; count < 5 ; count++){
								if (grid[row + dx[shift] * count][column + dy[shift] * count] == 'X')
									++Xs;
								else if (grid[row + dx[shift] * count][column + dy[shift] * count] == '.')
									++dot;
							}

							if (Xs == 4 && dot == 1){
								win = true;
								break out;
							}
						}
					}
				}
			}
		out.println(win ? "YES" : "NO");
		//---------------------Solution  End---------------------//
		out.flush();
		out.close();
	}
}
class Reader{

	BufferedReader bufferedReader;
	StringTokenizer stringTokenizer;

	public Reader(){
		bufferedReader = new BufferedReader(new InputStreamReader(System.in));
	}

	public String next(){
		while (stringTokenizer == null || !stringTokenizer.hasMoreElements()){
			try{
				stringTokenizer = new StringTokenizer(bufferedReader.readLine());
			}
			catch (IOException Ex){
				Ex.printStackTrace();
			}
		}
		return stringTokenizer.nextToken();
	}

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

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

	public double nextDouble(){
		return Double.parseDouble(this.next());
	}

	public String nextLine(){
		String str = "";
		try{
			str = bufferedReader.readLine();
		}
		catch (IOException Ex){
			Ex.printStackTrace();
		}
		return str;
	}

	public boolean ready() throws IOException{
		return bufferedReader.ready();
	}
}

import java.io.*;
import java.util.StringTokenizer;

/**
 *
 * @author Altynbek
 */
public class B {

    Scanner in;
    PrintWriter out;

    boolean check(char[] t) {
        int x = 0, p = 0;
        for (int i = 0; i < t.length; i++) {
            if (t[i] == 'X') {
                x++;
            } else if (t[i] == '.') {
                p++;
            }
        }
        return x == 4 && p == 1;
    }

    public void solve() throws Exception {
        char[][] f = new char[10][10];
        for (int i = 0; i < 10; i++) {
            f[i] = in.next().toCharArray();
        }
        boolean canWin = false;
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                String temp = "";
                for (int k = 0; k < 5 && j + k < 10; k++) {
                    temp += f[i][j + k];
                }
                if (check(temp.toCharArray())) {
                    canWin = true;
                }

                temp = "";
                for (int k = 0; k < 5 && i + k < 10 && j + k < 10; k++) {
                    temp += f[i + k][j + k];
                }
                if (check(temp.toCharArray())) {
                    canWin = true;
                }

                temp = "";
                for (int k = 0; k < 5 && i + k < 10; k++) {
                    temp += f[i + k][j];
                }
                if (check(temp.toCharArray())) {
                    canWin = true;
                }

                temp = "";
                for (int k = 0; k < 5 && i + k < 10 && j - k >= 0; k++) {
                    temp += f[i + k][j - k];
                }
                if (check(temp.toCharArray())) {
                    canWin = true;
                }
            }
        }

        out.println(canWin ? "YES" : "NO");
    }

    public void init() throws Exception {
        in = new Scanner(System.in);
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new B().init();
    }

    public class Scanner {

        private BufferedReader br;
        private StringTokenizer st;

        public Scanner(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() throws Exception {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

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

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

        public Double nextDouble() throws Exception {
            return Double.parseDouble(next());
        }
    }
}

import java.io.*;
import java.util.*;

public class Main {

    public static void main (String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        char[][] grid = new char[10][10];
        for (int i = 0; i < 10; i++) {
            String string = in.readLine();
            for (int j = 0; j < 10; j++) {
                grid[i][j] = string.charAt(j);
            }
        }
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                if (grid[i][j] == '.') {
                    int right = 0;
                    for (int k = 1; true; k++) {
                        if (j+k >= 10) {
                            break;
                        }
                        if (grid[i][j+k] != 'X') {
                            break;
                        }
                        right++;
                    }
                    for (int k = 1; true; k++) {
                        if (j-k < 0) {
                            break;
                        }
                        if (grid[i][j-k] != 'X') {
                            break;
                        }
                        right++;
                    }
                    right++;
                    if (right >= 5) {
                        System.out.println("YES");
                        return;
                    }
                    right = 0;
                    for (int k = 1; true; k++) {
                        if (i+k >= 10) {
                            break;
                        }
                        if (grid[i+k][j] != 'X') {
                            break;
                        }
                        right++;
                    }
                    for (int k = 1; true; k++) {
                        if (i-k < 0) {
                            break;
                        }
                        if (grid[i-k][j] != 'X') {
                            break;
                        }
                        right++;
                    }
                    right++;
                    if (right >= 5) {
                        System.out.println("YES");
                        return;
                    }
                    right = 0;
                    for (int k = 1; true; k++) {
                        if (i+k >= 10 || j + k >= 10) {
                            break;
                        }
                        if (grid[i+k][j+k] != 'X') {
                            break;
                        }
                        right++;
                    }
                    for (int k = 1; true; k++) {
                        if (i-k < 0 || j-k < 0) {
                            break;
                        }
                        if (grid[i-k][j-k] != 'X') {
                            break;
                        }
                        right++;
                    }
                    right++;
                    if (right >= 5) {
                        System.out.println("YES");
                        return;
                    }
                    right = 0;
                    for (int k = 1; true; k++) {
                        if (i+k >= 10 || j - k < 0) {
                            break;
                        }
                        if (grid[i+k][j-k] != 'X') {
                            break;
                        }
                        right++;
                    }
                    for (int k = 1; true; k++) {
                        if (i-k < 0 || j+k >= 10) {
                            break;
                        }
                        if (grid[i-k][j+k] != 'X') {
                            break;
                        }
                        right++;
                    }
                    right++;
                    if (right >= 5) {
                        System.out.println("YES");
                        return;
                    }
                }
            }
        }
        System.out.println("NO");
    }

}
/*
XXOXX.....
OO.O......
..........
..........
....X.....
.....X....
......X...
.......X..
..........
..........
NO

Process finished with exit code 0

 */

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[][] mat = new int[10][10];
            for (int i = 0; i < 10; i++) {
                String tmp = in.next();
                for (int j = 0; j < 10; j++) {
                    if (tmp.charAt(j) == '.')
                        mat[i][j] = 0;
                    else if (tmp.charAt(j) == 'X')
                        mat[i][j] = 1;
                    else
                        mat[i][j] = 2;
                }
            }
            for (int i = 0; i < 10; i++) {
                for (int j = 0; j < 10; j++) {
                    if (mat[i][j] != 0)
                        continue;
                    int l = cnt(mat, i, j, -1, 0);
                    int r = cnt(mat, i, j, 1, 0);
                    if (l + r >= 4) {
                        out.println("YES");
                        return;
                    }
                    int t = cnt(mat, i, j, 0, 1);
                    int b = cnt(mat, i, j, 0, -1);
                    if (t + b >= 4) {
                        out.println("YES");
                        return;
                    }
                    int tl = cnt(mat, i, j, -1, 1);
                    int br = cnt(mat, i, j, 1, -1);
                    if (tl + br >= 4) {
                        out.println("YES");
                        return;
                    }
                    int tr = cnt(mat, i, j, 1, 1);
                    int bl = cnt(mat, i, j, -1, -1);
                    if (tr + bl >= 4) {
                        out.println("YES");
                        return;
                    }
                }
            }
            out.println("NO");
        }

        public int cnt(int[][] mat, int x, int y, int dx, int dy) {
            int ret = 0;
            x += dx;
            y += dy;
            while (x >= 0 && x < 10 && y >= 0 && y < 10 && mat[x][y] == 1) {
                x += dx;
                y += dy;
                ret++;
            }
            return ret;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[16384];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;

@SuppressWarnings("unchecked")
public class P825B {

  char [][] f = new char [10][];

  boolean checkX(int x, int y) {
    return (((x < 10) && (y < 10) && (x >= 0) && (y >= 0)) ? (f[y][x] == 'X') : false);
  }

  boolean check() {
    for (int y = 0; y < 10; y++) {
      for (int x = 0; x < 10; x++) {
        boolean rx = true, cx = true, dx1 = true, dx2 = true;

        for (int d = 0; d < 5; d++) {
          rx  &= checkX(x + d,     y);
          cx  &= checkX(    x, y + d);
          dx1 &= checkX(x + d, y + d);
          dx2 &= checkX(x + d, y - d);
        }

        if (rx | cx | dx1 | dx2) {
          return true;
        }
      }
    }

    return false;
  }

  public void run() throws Exception {
    for (int i = 0; i < 10; f[i] = next().toCharArray(), i++);

    for (int y = 0; y < 10; y++) {
      for (int x = 0; x < 10; x++) {
        if (f[y][x] == '.') {
          f[y][x] = 'X';

          if (check()) {
            println("YES");
            return;
          }

          f[y][x] = '.';
        }
      }
    }

    println("NO");
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P825B().run();
    br.close();
    pw.close();
    System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]");
  }

  static long startTime = System.currentTimeMillis();
  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

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

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }

  int gcd(int a, int b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Integer.numberOfTrailingZeros(a), bz = Integer.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Integer.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Integer.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  long gcd(long a, long b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Long.numberOfTrailingZeros(a), bz = Long.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Long.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Long.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }
}

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;

public class B {

  private static final String REGEX = " ";
  private static final Boolean DEBUG = false;
  private static final String FILE_NAME = "input.txt";

  public static void main(String[] args) throws IOException {
    if (DEBUG) {
      generate();
    }
    Solver solver = new Solver();
    solver.readData();
    solver.solveAndPrint();
  }

  private static void generate() throws IOException {
//    FileWriter writer = new FileWriter("input.txt");
//    writer.close();
  }

  private static class Solver {

    String[] field = new String[10];
    int curI, curJ;

    void readData() throws IOException {
      InputStream in = DEBUG ? new FileInputStream(FILE_NAME) : System.in;
      Scanner scanner = new Scanner(in);
      for (int i = 0; i < 10; i++) {
        field[i] = scanner.nextLine();
      }
      scanner.close();
    }

    void solveAndPrint() {
      char c;
      for (int i = 0; i < 10; i++) {
        String row = field[i];
        for (int j = 0; j < 10; j++) {
          c = row.charAt(j);
          if (c == '.') {
            curI = i;
            curJ = j;
            if (check(i, j)) {
              System.out.println("YES");
              return;
            }
          }
        }
      }
      System.out.println("NO");
    }

    private boolean check(int i, int j) {
      if (checkHor(i, j - 4) || checkHor(i, j - 3) || checkHor(i, j - 2) || checkHor(i, j - 1) || checkHor(i, j)) {
        return true;
      }
      if (checkVer(i - 4, j) || checkVer(i - 3, j) || checkVer(i - 2, j) || checkVer(i - 1, j) || checkVer(i, j)) {
        return true;
      }
      if (checkDia(i - 4, j - 4, true) || checkDia(i - 3, j - 3, true) || checkDia(i - 2, j - 2, true) || checkDia(i - 1, j - 1, true) || checkDia(i, j, true)) {
        return true;
      }

      if (checkDia(i - 4, j + 4, false) || checkDia(i - 3, j + 3, false) || checkDia(i - 2, j + 2, false) || checkDia(i - 1, j + 1, false) || checkDia(i, j, false)) {
        return true;
      }
      return false;
    }

    private boolean checkHor(int i, int j) {
      int j1 = j;
      int i1 = i;
      for (int k = 0; k < 5; k++) {
        j1 = j + k;
        if (i1 < 0 || i1 >= 10 || j1 < 0 || j1 >= 10) {
          return false;
        }
        if (i1 == curI && j1 == curJ) {
          continue;
        }
        if (field[i1].charAt(j1) != 'X') {
          return false;
        }
      }
      return true;
    }

    private boolean checkVer(int i, int j) {
      int j1 = j;
      int i1 = i;
      for (int k = 0; k < 5; k++) {
        i1 = i + k;
        if (i1 < 0 || i1 >= 10 || j1 < 0 || j1 >= 10) {
          return false;
        }
        if (i1 == curI && j1 == curJ) {
          continue;
        }
        if (field[i1].charAt(j1) != 'X') {
          return false;
        }
      }
      return true;

    }

    private boolean checkDia(int i, int j, boolean right) {
      int j1 = j;
      int i1 = i;
      for (int k = 0; k < 5 ; k++) {
        if (right){
          i1 = i + k;
          j1 = j + k;
        } else {
          i1 = i + k;
          j1 = j - k;
        }
        if (i1 < 0 || i1 >= 10 || j1 < 0 || j1 >= 10) {
          return false;
        }
        if (i1 == curI && j1 == curJ) {
          continue;
        }
        if (field[i1].charAt(j1) != 'X') {
          return false;
        }
      }
      return true;
    }

    @SuppressWarnings("SameParameterValue")
    int[] splitInteger(String string, int n) {
      final String[] split = string.split(REGEX, n);
      int[] result = new int[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Integer.parseInt(split[i]);
      }
      return result;
    }

    public int[] splitInteger(String string) {
      return splitInteger(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    long[] splitLong(String string, int n) {
      final String[] split = string.split(REGEX, n);
      long[] result = new long[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Long.parseLong(split[i]);
      }
      return result;
    }

    public long[] splitLong(String string) {
      return splitLong(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    double[] splitDouble(String string, int n) {
      final String[] split = string.split(REGEX, n);
      double[] result = new double[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Double.parseDouble(split[i]);
      }
      return result;
    }

    public double[] splitDouble(String string) {
      return splitDouble(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    String[] splitString(String string, int n) {
      return string.split(REGEX, n);
    }

    public String[] splitString(String string) {
      return splitString(string, 0);
    }

    public int max(int a, int b) {
      return Math.max(a, b);
    }

    public long max(long a, long b) {
      return Math.max(a, b);
    }

    public int min(int a, int b) {
      return Math.min(a, b);
    }

    public long min(long a, long b) {
      return Math.min(a, b);
    }

    public double max(double a, double b) {
      return Math.max(a, b);
    }

    public double min(double a, double b) {
      return Math.min(a, b);
    }

    private final static int MOD = 1000000009;

    int multMod(int a, int b) {
      return ((a % MOD) * (b % MOD)) % MOD;
    }

    int sumMod(int a, int b) {
      return ((a % MOD) + (b % MOD)) % MOD;
    }

    long multMod(long a, long b) {
      return ((a % MOD) * (b % MOD)) % MOD;
    }

    long sumMod(long a, long b) {
      return ((a % MOD) + (b % MOD)) % MOD;
    }
  }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class SolutionB {

    public static void main(String[] args) throws IOException {
        Reader reader = new Reader();
        char[][] matrix = new char[10][10];
        for (int i = 0; i < 10; i++) {
            String row = reader.readStringValue();
            for (int j = 0; j < row.length(); j++) {
                matrix[i][j] = row.charAt(j);
            }
        }

        boolean doCrossesWin = findHorizontalPos(matrix) || findVerticalPos(matrix)
                || findDiagonalLeftToRight1(matrix) || findDiagonalLeftToRight2(matrix)
                || findDiagonalRightToLeft1(matrix) || findDiagonalRightToLeft2(matrix);

        if (doCrossesWin) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }

    private static boolean findHorizontalPos(char[][] matrix) {
        for (int i = 0; i < 10; i++) {
            int currHorizontalSequence = 0;
            boolean isReplacementMade = false;
            for (int j = 0; j < 10; j++) {
                if (matrix[i][j] == 'X') {
                    currHorizontalSequence++;
                } else if (matrix[i][j] == 'O') {
                    currHorizontalSequence = 0;
                    isReplacementMade = false;
                } else if (matrix[i][j] == '.' && !isReplacementMade) {
                    isReplacementMade = true;
                    currHorizontalSequence++;
                } else if (matrix[i][j] == '.' && isReplacementMade) {
                    currHorizontalSequence = 0;
                    j--;
                    while (j >= 0 && matrix[i][j] == 'X') {
                        j--;
                    }
                    isReplacementMade = false;
                }

                if (currHorizontalSequence == 5) {
                    return true;
                }
            }
        }
        return false;
    }

    private static boolean findVerticalPos(char[][] matrix) {
        for (int i = 0; i < 10; i++) {
            int currVerticalSequence = 0;
            boolean isReplacementMade = false;
            for (int j = 0; j < 10; j++) {
                if (matrix[j][i] == 'X') {
                    currVerticalSequence++;
                } else if (matrix[j][i] == 'O') {
                    currVerticalSequence = 0;
                    isReplacementMade = false;
                } else if (matrix[j][i] == '.' && !isReplacementMade) {
                    currVerticalSequence++;
                    isReplacementMade = true;
                } else if (matrix[j][i] == '.' && isReplacementMade) {
                    currVerticalSequence = 0;
                    j--;
                    while (j >= 0 && matrix[j][i] == 'X') {
                        j--;
                    }
                    isReplacementMade = false;
                }
                if (currVerticalSequence == 5) {
                    return true;
                }

            }
        }
        return false;
    }

    private static boolean findDiagonalLeftToRight1(char[][] matrix) {

        for (int k = 0; k < 10; k++) {
            int currDiagonalSequence = 0;
            boolean isReplacementMade = false;
            for (int i = 0; i < 10 - k; i++) {
                if (matrix[i + k][i] == 'X') {
                    currDiagonalSequence++;
                } else if (matrix[i + k][i] == 'O') {
                    currDiagonalSequence = 0;
                    isReplacementMade = false;
                } else if (matrix[i + k][i] == '.' && !isReplacementMade) {
                    currDiagonalSequence++;
                    isReplacementMade = true;
                } else if(matrix[i + k][i] == '.' && isReplacementMade) {
                    currDiagonalSequence = 0;
                    i--;
                    while (i >= 0 && matrix[i + k][i] == 'X') {
                        i--;
                    }
                    isReplacementMade = false;
                }

                if(currDiagonalSequence == 5) {
                    return true;
                }
            }
        }

        return false;
    }

    private static boolean findDiagonalLeftToRight2(char[][] matrix) {

        for (int k = 0; k < 10; k++) {
            int currDiagonalSequence = 0;
            boolean isReplacementMade = false;
            for (int i = 0; i < 10 - k; i++) {
                if (matrix[i][i + k] == 'X') {
                    currDiagonalSequence++;
                } else if (matrix[i][i + k] == 'O') {
                    currDiagonalSequence = 0;
                    isReplacementMade = false;
                } else if (matrix[i][i + k] == '.' && !isReplacementMade) {
                    currDiagonalSequence++;
                    isReplacementMade = true;
                } else if(matrix[i][i + k] == '.' && isReplacementMade) {
                    currDiagonalSequence = 0;
                    i--;
                    while (i >= 0 && matrix[i][i + k] == 'X') {
                        i--;
                    }
                    isReplacementMade = false;
                }

                if(currDiagonalSequence == 5) {
                    return true;
                }
            }
        }

        return false;
    }

    private static boolean findDiagonalRightToLeft1(char[][] matrix) {
        for (int k = 9; k >= 0; k--) {
            int currDiagonalSequence = 0;
            boolean isReplacementMade = false;
            for (int i = 0; i <= k; i++) {
                if (matrix[k - i][i] == 'X') {
                    currDiagonalSequence++;
                } else if (matrix[k - i][i] == 'O') {
                    currDiagonalSequence = 0;
                    isReplacementMade = false;
                } else if (matrix[k - i][i] == '.' && !isReplacementMade) {
                    currDiagonalSequence++;
                    isReplacementMade = true;
                } else if(matrix[k - i][i] == '.' && isReplacementMade) {
                    currDiagonalSequence = 0;
                    i--;
                    while (i >= 0 && matrix[k - i][i] == 'X') {
                        i--;
                    }
                    isReplacementMade = false;
                }

                if(currDiagonalSequence == 5) {
                    return true;
                }
            }
        }

        return false;
    }

    private static boolean findDiagonalRightToLeft2(char[][] matrix) {
        for(int k = 9; k >= 0; k--) {
            int currDiagonalSequence = 0;
            boolean isReplacementMade = false;
            for(int i = 0; i < 10 - k ; i++) {
                if(matrix[k + i][9 - i] == 'X') {
                    currDiagonalSequence++;
                } else if (matrix[k + i][9 - i]  == 'O') {
                    currDiagonalSequence = 0;
                    isReplacementMade = false;
                } else if (matrix[k + i][9 - i]  == '.' && !isReplacementMade) {
                    currDiagonalSequence++;
                    isReplacementMade = true;
                } else if(matrix[k + i][9 - i]  == '.' && isReplacementMade) {
                    currDiagonalSequence = 0;
                    i--;
                    while (i <= 10 - k && matrix[k + i][9 - i]  == 'X') {
                        i--;
                    }
                    isReplacementMade = false;
                }

                if(currDiagonalSequence == 5) {
                    return true;
                }

            }
        }

        return false;
    }

}

class Reader {

    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));

    public StringTokenizer getStringTokenizer() throws IOException {
        String line = bufferedReader.readLine().replaceAll("\\s+$", "");
        return new StringTokenizer(line, " ");
    }

    public int getNextInt(StringTokenizer stringTokenizer) {
        while (stringTokenizer.hasMoreTokens()) {
            return Integer.parseInt(stringTokenizer.nextToken());
        }
        throw new RuntimeException("no more tokens in string");
    }

    public long getNextLong(StringTokenizer stringTokenizer) {
        while (stringTokenizer.hasMoreTokens()) {
            return Long.parseLong(stringTokenizer.nextToken());
        }
        throw new RuntimeException("no more tokens in string");
    }

    public String getNextString(StringTokenizer stringTokenizer) {
        while (stringTokenizer.hasMoreTokens()) {
            return stringTokenizer.nextToken();
        }
        throw new RuntimeException("no more tokens in string");
    }

    public String readStringValue() throws IOException {
        return bufferedReader.readLine().replaceAll("\\s+$", "");
    }

    public int readIntValue() throws IOException {
        String line = bufferedReader.readLine().replaceAll("\\s+$", "");
        int parsedToInt = Integer.parseInt(line);
        return parsedToInt;
    }

    public int[] readIntNumbers() throws IOException {
        String[] line = bufferedReader.readLine().replaceAll("\\s+$", "").split(" ");
        int[] parsedToInt = Arrays.stream(line).mapToInt(Integer::parseInt).toArray();
        return parsedToInt;
    }

    public long readLongValue() throws IOException {
        String line = bufferedReader.readLine().replaceAll("\\s+$", "");
        long parsedToLong = Long.parseLong(line);
        return parsedToLong;
    }

    public long[] readLongNumbers() throws IOException {
        String[] line = bufferedReader.readLine().replaceAll("\\s+$", "").split(" ");
        long[] parsedToLong = Arrays.stream(line).mapToLong(Long::parseLong).toArray();
        return parsedToLong;
    }

}

import java.io.*;
import java.util.StringTokenizer;

public class ConnectFiveE25B {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();
        char[][] matrix = new char[10][10];
        for (int i = 0; i < 10; i++) {
            String s = in.nextLine();
            for (int j = 0; j < 10; j++) {
                matrix[i][j] = s.charAt(j);
            }
        }

        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                if (matrix[i][j] == '.') {
                    matrix[i][j] = 'X';
                    if (hasWon(matrix)) {
                        System.out.println("YES");
                        return;
                    }
                    matrix[i][j] = '.';
                }
            }
        }

        System.out.println("NO");
    }

    public static boolean hasWon(char[][] matrix) {
        for (int i = 0; i < 6; 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 < 10; i++) {
            for (int j = 0; j < 6; 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 < 6; i++) {
            for (int j = 0; j < 6; 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 < 6; 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 class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

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

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

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

import java.util.Scanner;

public class Fiveinrow {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		boolean isRowGood=false;
		boolean isCoGood=false;
		boolean isDiaGood=false;
		boolean isReDiaGood=false;
		int[][]a=new int[10][10];
		int[][]b=new int[10][10];
		Scanner in = new Scanner(System.in);
		for(int i=0;i<10;i++) {
			String s=in.next();
			for(int j=0;j<10;j++) {
				if(s.charAt(j)=='O')
					a[i][j]=-1;
				else if(s.charAt(j)=='X')
					a[i][j]=1;
				else
					a[i][j]=0;
				b[i][9-j]=a[i][j];
			}
		}
		here:for(int i=0;i<10;i++) {
				for(int j=0;j<6;j++) {
					if(a[i][j]+a[i][j+1]+a[i][j+2]+a[i][j+3]+a[i][j+4]>=4) {
						isRowGood=true;
						break here;
					}
					if(a[j][i]+a[j+1][i]+a[j+2][i]+a[j+3][i]+a[j+4][i]>=4) {
						isCoGood=true;
						break here;
					}
				}
			}
		there:for(int i=0;i<6;i++) {
				for(int j=0;j<6;j++) {
					if(a[i][j]+a[i+1][j+1]+a[i+2][j+2]+a[i+3][j+3]+a[i+4][j+4]>3) {
						isDiaGood=true;
						break there;
					}
					if(b[i][j]+b[i+1][j+1]+b[i+2][j+2]+b[i+3][j+3]+b[i+4][j+4]>3) {
						isReDiaGood=true;
						break there;
					}
				}
		}
		if(isRowGood||isCoGood ||isDiaGood ||isReDiaGood  )
			System.out.print("YES");
		else
			System.out.print("NO");
	}
}

import java.util.Scanner;

public class fiveinarow {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		winner();

	}
	public static void winner()
	{
		Scanner sc=new Scanner(System.in);
		String[] str=new String[10];
		char[][]ch=new char[10][10];
		for(int i=0;i<10;i++)
		{
			str[i]=sc.nextLine();
		}
		for(int i=0;i<10;i++)
		{
			for(int j=0;j<10;j++)
			{
				ch[i][j]=str[i].charAt(j);
			}
		}
		int flag=0;
		int count1=0;
		int count2=0;
		int count3=0;
		int count4=0;
		for(int i=0;i<=9&&flag==0;i++)
		{
			for(int j=0;j<=5&&flag==0;j++)
			{
				count1=0;
				for(int k=j;k<=j+4;k++)
				{
					if(ch[i][k]=='X')
						count1++;
					else if(ch[i][k]=='O')
					{
						count1=0;
						break;
					}
					else
						count1=count1;
				}
				if(count1==4)
					flag=1;
			}
		}
		for(int i=0;i<=5&&flag==0;i++)
		{
			for(int j=0;j<=9&&flag==0;j++)
			{
				count2=0;
				for(int k=i;k<=i+4;k++)
				{
					if(ch[k][j]=='X')
						count2++;
					else if(ch[k][j]=='O')
					{
						count2=0;
						break;
					}
					else
						count2=count2;
				}
				if(count2==4)
					flag=1;
			}
		}
		for(int i=0;i<=5&&flag==0;i++)
		{
			for(int j=0;j<=5&&flag==0;j++)
			{
				count3=0;
				int jth=j;
				int ith=i;
				for(int k=1;k<=5;k++,ith++,jth++)
				{
					if(ch[ith][jth]=='X')
						count3++;
					else if(ch[ith][jth]=='O')
					{
						count3=0;
						break;
					}
					else
					{
						count3=count3;
					}
				}
				if(count3==4)
					flag=1;
			}
		}
		for(int i=0;i<=5&&flag==0;i++)
		{
			for(int j=9;j>=4&&flag==0;j--)
			{
				count4=0;
				int ith=i;
				int jth=j;
				for(int k=1;k<=5;k++,ith++,jth--)
				{
					if(ch[ith][jth]=='X')
						count4++;
					else if(ch[ith][jth]=='O')
					{
						count4=0;
						break;
					}
					else
						count4=count4;
				}
				if(count4==4)
					flag=1;
			}
		}
		if(flag==1)
			System.out.println("YES");
		else
			System.out.println("NO");
	}

}

//package virt_contest_27_7_17;

import java.util.Scanner;

public class QB2 {
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		String str;
		char mat[][]=new char[10][10];
		for(int i=0;i<10;++i)
		{
			str=sc.nextLine();
			for(int j=0;j<str.length();++j)
			{
				mat[i][j]=str.charAt(j);
			}
		}
		if(processInput(mat))
		{
			System.out.println("YES");
		}
		else
		{
			System.out.println("NO");
		}
	}
	public static boolean processInput(char mat[][])
	{
		for(int i=0;i<10;++i)
		{
			for(int j=0;j<10;++j)
			{
				if(mat[i][j]=='.' && checkSuccess(mat,i,j))
				{
					return true;
				}
			}
		}
		return false;
	}
	public static boolean checkSuccess(char mat[][],int row,int col)
	{
		if(checkUpDown(mat,row,col) || checkLeftRight(mat,row,col) || checkDiagonals(mat,row,col))
		{
			return true;
		}
		return false;
	}
	public static boolean checkUpDown(char mat[][],int row,int col)
	{
		int top=0,bottom=0;
		//checking top
		for(int i=row-1;i>=0;--i)
		{
			if(mat[i][col]=='X')
			{
				top++;
			}
			else
			{
				break;
			}
		}
		//checking bottom
		for(int i=row+1;i<10;++i)
		{
			if(mat[i][col]=='X')
			{
				bottom++;
			}
			else
			{
				break;
			}
		}
		if(top+bottom>=4)
		{
			return true;
		}
		return false;
	}
	public static boolean checkLeftRight(char mat[][],int row,int col)
	{
		int left=0,right=0;
		//checking left
		for(int j=col-1;j>=0;--j)
		{
			if(mat[row][j]=='X')
			{
				left++;
			}
			else
			{
				break;
			}
		}
		//checking right
		for(int j=col+1;j<10;++j)
		{
			if(mat[row][j]=='X')
			{
				right++;
			}
			else
			{
				break;
			}
		}
		if(left+right>=4)
		{
			return true;
		}
		return false;
	}
	public static boolean checkDiagonals(char mat[][],int row,int col)
	{
		int d1l=0,d2l=0,d1r=0,d2r=0;
		//digonal 1
		for(int i=row-1,j=col-1;i>=0 && j>=0 ;--i,--j)
		{
			if(mat[i][j]=='X')
			{
				d1l++;
			}
			else
			{
				break;
			}
		}

		for(int i=row+1,j=col+1;i<10 && j<10; ++i,++j)
		{
			if(mat[i][j]=='X')
			{
				d1r++;
			}
			else
			{
				break;
			}
		}
		//diagonal 2
		for(int i=row+1,j=col-1;i<10 && j>=0;++i,--j)
		{
			if(mat[i][j]=='X')
			{
				d2l++;
			}
			else
			{
				break;
			}
		}

		for(int i=row-1,j=col+1;i>=0 && j<10;--i,++j)
		{
			if(mat[i][j]=='X')
			{
				d2r++;
			}
			else
			{
				break;
			}
		}

		if(d1l+d1r>=4 || d2l+d2r>=4)
		{
			return true;
		}
		return false;
	}
}

//package Jul22;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

/**
 * Created by kandarp.jo on 22/07/17.
 */
public class B {
    public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    public static PrintWriter out = new PrintWriter(System.out);
    public static void main(String cd[]) throws  Exception{
        char array[][] = new char[10][10];
        for(int i=0;i<10;i++){
            String s = in.readLine();
            for(int j=0;j<10;j++){
                array[i][j] = s.charAt(j);
            }
        }
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                if(array[i][j]=='.'){

                    array[i][j] = 'X';
                    if(check(array)){
                        out.println("YES");
                        out.close();
                        System.exit(0);
                    }
                    array[i][j]='.';
                }
            }
        }
        out.println("NO");
        out.close();

    }
    public static boolean check(char[][] array){
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                char tmp ='X';
                int count =0;
                for(int k=0;k<5;k++){
                    if(j+k <10 && array[i][j+k]==tmp){
                        count++;
                    }
                }
                if(count == 5){
                    return true;
                }

                count=0;
                for(int k=0;k<5;k++){
                    if(i+k<10 && array[i+k][j]==tmp)
                        count++;
                }
                if(count==5){
                    return true;
                }
                count=0;
                for(int k=0;k<5;k++){
                    if(i-k>=0 && array[i-k][j]==tmp)
                        count++;
                }
                if(count==5){
                    return true;
                }
                count=0;
                for(int k=0;k<5;k++){
                    if(j-k>=0 && array[i][j-k]==tmp)
                        count++;
                }
                if(count==5){
                    return true;
                }
                count=0;
                for(int k=0;k<5;k++){
                    if(i+k<10 && j+k<10 && array[i+k][j+k]==tmp){
                        count++;
                    }
                }
                if(count==5){
                    return true;
                }
                count=0;
                for(int k=0;k<5;k++){
                    if(i-k>=0 && j+k<10 && array[i-k][j+k]==tmp){
                        count++;
                    }
                }
                if(count==5){
                    return true;
                }

                count=0;
                for(int k=0;k<5;k++){
                    if(i-k>=0 && j-k>=0 && array[i-k][j-k]==tmp){
                        count++;
                    }
                }
                if(count==5){
                    return true;
                }

                count=0;
                for(int k=0;k<5;k++){
                    if(i+k<10 && j-k>=0 && array[i+k][j-k]==tmp){
                        count++;
                    }
                }
                if(count==5){
                    return true;
                }

            }

        }
        return false;
    }

}

import java.util.*;
public class fiverow
{
   static char[][] board;
    public static void main(String[] args)
    {

        board= new char[10][10];
        Scanner s= new Scanner(System.in);
        boolean done=false;
        for (int i=0; i<10; i++)
        {
            String temp=s.next();
            for (int j=0; j<10; j++)
            {
                board[i][j]=temp.charAt(j);
            }
        }

         for (int i=0; i<10; i++)
        {
            for (int j=0; j<10; j++)
            {
               if (board[i][j]=='X')
               {
                  if (traverse(i,j,-1,0)||traverse(i,j,1,0)||traverse(i,j,0,-1)||traverse(i,j,0,1)||traverse(i,j,-1,-1)||traverse(i,j,1,-1)||traverse(i,j,1,1)||traverse(i,j,-1,1))
                  {
                      System.out.println("YES");
                      done=true;
                      break;
                   }
                }
            }
            if (done) break;
        }
        if (!done) System.out.println("NO");
    }

    public static boolean traverse(int x, int y,int dx, int dy)
    {
        int count=0; boolean empty=false;
        while (x>=0&&x<10&&y>=0&&y<10)
        {
            if ( x+dx>=0 && y+dy>=0 && x+dx<10 && y+dy<10 &&board[x+dx][y+dy]=='X') count++;
            else if ( x+dx>=0 && y+dy>=0 && x+dx<10 && y+dy<10 &&board[x+dx][y+dy]=='.'&& !empty) {count++; empty=true;}
            else break;

            x+=dx; y+=dy;
        }
        if (count==4) return true;
        return false;
    }

}

import java.util.Scanner;

public class FiveInRow {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        boolean checker = false;
        String[] array = new String[10];
        for (int i = 0; i < 10; i++){
            array[i] = sc.nextLine();
            if (!checker) {
                checker = checkTheLine(array[i]);
            }
        }
        if (checker || verticalLinesBuilder(array)){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
    public static boolean checkTheLine(String line){
        if (line.contains(".XXXX") || line.contains("X.XXX") ||
                line.contains("XX.XX") || line.contains("XXX.X") || line.contains("XXXX.")){
            return true;
        }
        return false;
    }

    public static boolean verticalLinesBuilder(String[] array) {
        int i = 10;
        while (--i >= 0) {
            String line = "";
            for (int j = 0; j < 10; j++) {
                line += array[j].charAt(i);
            }
            if (checkTheLine(line)){
                return true;
            } else {
                if (upDiagonalLinesBuilder(array) || downDiagonalLinesBuilder(array)){
                    return true;
                }
            }
        }
        return false;
    }

    public static boolean upDiagonalLinesBuilder(String[] array){
        int temp = 3;
        while (++temp <=9){
            String line = "";
            for (int i = 0; i <=temp; i++){
                line +=array[i].charAt(temp-i);
            }
            if (checkTheLine(line)){
                return true;
            }
        }
        temp = 15;
        while (--temp >=10){
            String line = "";
            for (int i = 9; i >=temp-9; i--){
                line +=array[i].charAt(temp-i);
            }
            if (checkTheLine(line)){
                return true;
            }
        }
        return false;
    }

    public static boolean downDiagonalLinesBuilder(String[] array) {
        int temp = 6;
        while (--temp >=0) {
            String line = "";
            for (int i = temp; i <= 9; i++) {
                line += array[i].charAt(i-temp);
            }
            if (checkTheLine(line)) {
                return true;
            }
        }
        temp = 6;
        while (--temp>0) {
            String line = "";
            for (int i = 0; i <=9-temp; i++) {
                line += array[i].charAt(temp + i);
            }
            if (checkTheLine(line)) {
                return true;
            }
        }
        return false;
    }
}

import java.io.*;
import java.util.Arrays;

public class Main {

    private static myScanner sc;
    private static PrintWriter pw;

    private static final boolean defaultInAndOutPut = true;

    private static final int numberOfTests = 1;

    private static final String nameOfInAndOutFile = "";
    private static final String fullNameInputFile = nameOfInAndOutFile + ".in";
    private static final String fullNameOutputFile = nameOfInAndOutFile + ".out";

    public static void main(String[] args) throws IOException {
        if (defaultInAndOutPut) {
            setDefaultInAndOutPut();
        } else {
            setInAndOutPutFromFile();
        }
        for (int test = 1; test <= numberOfTests; test++) {
            solve();
            pw.flush();
        }

        pw.close();
    }

    private static void setDefaultInAndOutPut() {
        sc = new myScanner(new BufferedReader(new InputStreamReader(System.in)));
        pw = new PrintWriter(System.out);
    }

    private static void setInAndOutPutFromFile() throws IOException {
        sc = new myScanner(new BufferedReader(new FileReader(new File(fullNameInputFile))));
        pw = new PrintWriter(new File(fullNameOutputFile));
    }

    private static final int intINF = Integer.MAX_VALUE;
    private static final long longINF = Long.MAX_VALUE;

    private static void solve() {
        int[][] s = new int[10][10];
        for (int i=0;i<10;i++){
            String m = sc.nextLine();
            for (int j=0;j<10;j++){
                if (m.charAt(j)=='O')s[i][j]=-100;
                else if (m.charAt(j)=='X')s[i][j]=1;
            }
        }
        boolean ans = false;
        for (int i=0;i<10;i++){
            for (int j=0;j<6;j++){
                int sum =0;
                for (int k=0;k<5;k++)sum+=s[i][j+k];
                if (sum==4)ans=true;
            }
        }
        for (int i=0;i<10;i++){
            for (int j=0;j<6;j++){
                int sum =0;
                for (int k=0;k<5;k++)sum+=s[j+k][i];
                if (sum==4)ans=true;
            }
        }
        for (int i=0;i<6;i++){
            for (int j=0;j<6;j++){
                int sum=0;
                for (int k=0;k<5;k++)sum+=s[j+k][i+k];
                if (sum==4)ans=true;
            }
        }
        for (int i=9;i>3;i--){
            for (int j=0;j<6;j++){
                int sum=0;
                for (int k=0;k<5;k++)sum+=s[j+k][i-k];
                if (sum==4)ans=true;
            }
        }
        pw.print(ans?"YES":"NO");
    }
}

class myScanner {
    private char[] buffer = new char[1 << 8];
    private int pos = 1;

    private BufferedReader reader;

    public myScanner(BufferedReader reader) {
        this.reader = reader;
    }

    public boolean hasNext() {
        return pos > 0;
    }

    private void loadBuffer() {
        pos = 0;
        try {
            for (int i; (i = reader.read()) != -1; ) {
                char c = (char) i;
                if (c != ' ' && c != '\n' && c != '\t' && c != '\r' && c != '\f') {
                    if (pos == buffer.length) buffer = Arrays.copyOf(buffer, 2 * pos);
                    buffer[pos++] = c;
                } else if (pos != 0) break;
            }
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    public String current() {
        return String.copyValueOf(buffer, 0, pos);
    }

    public String next() {
        loadBuffer();
        return current();
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    public int nextInt() {
        return nextInt(10);
    }

    public long nextLong() {
        return nextLong(10);
    }

    public int nextInt(int radix) {
        loadBuffer();
        int result = 0;
        int i = buffer[0] == '-' || buffer[0] == '+' ? 1 : 0;
        for (checkValidNumber(pos > i); i < pos; i++) {
            int digit = buffer[i] - '0';
            checkValidNumber(0 <= digit && digit <= radix - 1);
            result = result * radix + digit;
        }
        return buffer[0] == '-' ? -result : result;
    }

    public long nextLong(int radix) {
        loadBuffer();
        long result = 0;
        int i = buffer[0] == '-' || buffer[0] == '+' ? 1 : 0;
        for (checkValidNumber(pos > i); i < pos; i++) {
            int digit = buffer[i] - '0';
            checkValidNumber(0 <= digit && digit <= radix - 1);
            result = result * radix + digit;
        }
        return buffer[0] == '-' ? -result : result;
    }

    public int[] nextArrayInts(int size){
        int[] input = new int[size];
        for (int i=0;i<size;i++)input[i]=nextInt();
        return input;
    }

    public long[] nextArrayLongs(int size){
        long[] input = new long[size];
        for (int i=0;i<size;i++)input[i]=nextLong();
        return input;
    }

    public double nextDouble() {
        loadBuffer();
        long result = 0;
        int i = buffer[0] == '-' || buffer[0] == '+' ? 1 : 0;
        long round = 1;
        final int radix = 10;
        boolean hasPoint = false;
        for (checkValidNumber(pos > i); i < pos; i++) {
            int digit = buffer[i] - '0';
            checkValidNumber((0 <= digit && digit <= radix - 1) || (!hasPoint && digit == -2));
            if (digit == -2) hasPoint = true;
            else {
                if (hasPoint) round *= radix;
                result = result * radix + digit;
            }

        }
        return buffer[0] == '-' ? -result / (1.0 * round) : result / (1.0 * round);
    }

    private void checkValidNumber(boolean condition) {
        if (!condition) throw new NumberFormatException(current());
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemB {
    BufferedReader rd;

    ProblemB() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        char[][] c = new char[10][];
        for(int i=0;i<10;i++) {
            c[i] = rd.readLine().toCharArray();
        }

        boolean ok = false;
        outer: for(int i=0;i<10;i++) {
            for (int j = 0; j < 10; j++) {
                if(c[i][j]=='.') {
                    c[i][j] = 'X';
                    if(aliceWon(c)) {
                        ok = true;
                        break outer;
                    }
                    c[i][j] = '.';
                }
            }
        }
        out(ok?"YES":"NO");
    }

    private boolean aliceWon(char[][] c) {
        int[][] ds = new int[][] {
                { 0, 1 },
                { 0, -1 },
                { 1, 1 },
                { 1, -1 },
                { -1, 0 },
                { 1, 0 },
                { -1, -1 },
                { -1, 1 }
        };
        for(int i=0;i<10;i++) {
            for(int j=0;j<10;j++) {
                for(int[] d: ds) {
                    int x = i;
                    int y = j;
                    int cnt = 0;
                    while(true) {
                        if (x >= 0 && x < 10 && y >= 0 && y < 10) {
                            if (c[x][y] != 'X') {
                                break;
                            }
                            cnt++;
                            x += d[0];
                            y += d[1];
                        } else {
                            break;
                        }
                    }
                    if(cnt >= 5) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    private static void out(Object x) {
        System.out.println(x);
    }

    public static void main(String[] args) throws IOException {
        new ProblemB();
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;

public class Competitive_1 {

	static char arr[][];

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		arr = new char[10][];
		for(int i=0; i<10; i++)
			arr[i] = in.next().toCharArray();

		boolean ans = false;
		for(int i=0; i<10; i++){
			for(int j=0; j<10; j++){
				if(arr[i][j]=='X' || arr[i][j]=='.')
					ans = canWin(i, j, 5, true, 0, 1) || canWin(i, j, 5, true, 1, 1) || canWin(i, j, 5, true, 1, -1) || canWin(i, j, 5, true, 1, 0);
				if(ans){
					System.out.println("YES");
					return;
				}
			}
		}

		System.out.println("NO");
	}

	public static boolean canWin(int i, int j, int need, boolean canBlank, int dirX, int dirY){
		if(need == 0)
			return true;
		if(i<0 || i>=10 || j<0 || j>=10 || arr[i][j]=='O' || (canBlank==false && arr[i][j]=='.'))
			return false;

		if(arr[i][j]=='.')
			canBlank = false;

		return canWin(i+dirX, j+dirY, need-1, canBlank, dirX, dirY);
	}

	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Solution {

    static void transposition(char [][]mass){
        char temp;
        for(int i = 0; i < 10; i ++){// reverse
            for(int j = 0; j < 10; j ++){
                if(i <= j){
                    temp = mass[i][j];
                    mass[i][j] = mass[j][i];
                    mass[j][i] = temp;
                }
            }
        }
    }

    static void reverseMass(char [][]mass){
        char [][] newMass = new char[10][10];
        for(int i = 0; i < 10; i ++){// reverse
            for(int j = 0; j < 10; j ++){
                //temp = mass[i][j];
                newMass[i][j] = mass[9-j][i];
                //mass[9-j][i] = temp;
            }
        }/*
        System.out.println("reverse: ");
        for(int i = 0; i < 10; i ++){// reverse
            for(int j = 0; j < 10; j ++){
                System.out.print(newMass[i][j]);
            }
            System.out.println();
        }*/
    }

    static int proverka_line(char [][]mass){
        int isRow = 0;
        int st_i, st_j;
        int countX, countP;
        for(int i = 0; i < 10; i ++){
                st_i = i;
                for(int j = 0; j < 6; j ++){
                    st_j = j;
                    countX = 0;
                    countP = 0;
                    for(int k = 0; k < 5; k ++){
                        if(mass[st_i][st_j] == 'X'){
                            countX++;
                        }
                        else if(mass[st_i][st_j] == '.'){
                            countP++;
                        }
                        st_j++;
                    }
                    if(countX == 4 && countP == 1){
                        isRow = 1;
                        //System.out.println("YES_line");
                    }
                }
        }
        return isRow;
    }

    static int proverka_diagonal(char [][]mass){
        int isRow = 0, first_i, first_j, countX, countP;
        for(int i = 4; i < 10; i ++){
            for(int j = 0; j < 6; j ++){
                first_i = i;
                first_j = j;
                countX = 0;
                countP = 0;
                for(int k = 0; k < 5; k ++){
                    if(mass[first_i][first_j] == 'X'){
                        countX++;
                    }
                    else if(mass[first_i][first_j] == '.'){
                        countP++;
                    }
                    first_i--; first_j++;
                }
                if(countX == 4 && countP == 1){
                    isRow = 1;
                    //System.out.println("YES_diag");
                }
            }
        }
        return isRow;
    }

    public static void main(String[] args) throws IOException {

        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

        char [][]mass = new char[10][];
        for(int i = 0; i < 10; i ++){
                    mass[i] = input.readLine().toCharArray();
        }

        Integer vert = 0, horiz = 0;
        int leftRightDiag = 0, rightLeftDiag = 0;

        for(int q = 0; q < 2; q ++){
            if(q == 0){ //horiz
                horiz = proverka_line(mass);
                leftRightDiag = proverka_diagonal(mass);
            }
            if(q == 1){ //vert
                reverseMass(mass);
                char [][] newMass = new char[10][10];
                for(int i = 0; i < 10; i ++){// reverse
                    for(int j = 0; j < 10; j ++){
                    newMass[i][j] = mass[9-j][i];
                    }
                }
                vert = proverka_line(newMass);
                rightLeftDiag = proverka_diagonal(newMass);
            }
        }
        if(horiz == 1 || leftRightDiag == 1 || vert == 1 || rightLeftDiag == 1){
            System.out.println("YES");
        }
        else System.out.println("NO");
        //System.out.println("horiz = " + horiz + " lrDiag = " + leftRightDiag + " vert = " + vert + " rlDiag = " + rightLeftDiag);

    }
}

import java.util.*;
import java.io.*;
public class Main
{
public static void main(String...jsbgh) throws IOException
{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
char c[][]=new char[12][12];

for(int i=0;i<10;i++)
{String t=br.readLine();
char x[]=t.toCharArray();
for (int l=0;l<x.length;l++)
{
 c[i+1][l+1]=x[l];
}

}

for(int i=1;i<c.length-1;i++)
{
  for(int j=1;j<c[0].length-1;j++)
   {
	   if(c[i][j]=='X')
	   { int count=0;
	     int r=i;
		 int col=j;
		  while(c[i][j]=='X')
		  {
		     count++;
			 j++;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  if(c[i][j]=='.')
		  {
		    count++;
			j++;
			if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  while(c[i][j]=='X')
		  {
		     count++;
			 j++;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  count=0;
		  i=r;
		  j=col;
		  while(c[i][j]=='X')
		  {
		     count++;
			 j--;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  if(c[i][j]=='.')
		  {
		    count++;
			j--;
			if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  while(c[i][j]=='X')
		  {
		     count++;
			 j--;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  count=0;
		  i=r;
		  j=col;

		  while(c[i][j]=='X')
		  {
		     count++;
			 i++;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		    if(c[i][j]=='.')
		  {
		    count++;
			i++;
			if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  while(c[i][j]=='X')
		  {
		     count++;
			 i++;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  count=0;
		  i=r;
		  j=col;

		  while(c[i][j]=='X')
		  {
		     count++;
			 i--;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		    if(c[i][j]=='.')
		  {
		    count++;
			i--;
			if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  while(c[i][j]=='X')
		  {
		     count++;
			 i--;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  count=0;
		  i=r;
		  j=col;

		  while(c[i][j]=='X')
		  {
		     count++;
			 i++;
			 j++;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }
		    if(c[i][j]=='.')
		  {
		    count++;
			i++;
			j++;
			if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  while(c[i][j]=='X')
		  {
		     count++;
			 i++;
			 j++;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  count=0;
		  i=r;
		  j=col;

		  while(c[i][j]=='X')
		  {  //System.out.print(i+" "+j);
		     count++;
			 i--;
			 j--;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		    if(c[i][j]=='.')
		  {// System.out.print(i+" "+j);

		    count++;
			//System.out.print("count"+count);
			i--;
			j--;
			if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  while(c[i][j]=='X')
		  {
		     count++;
			 i--;
			 j--;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		 count=0;
		  i=r;
		  j=col;

		  while(c[i][j]=='X')
		  {  //System.out.print(i+" "+j);
		     count++;
			 i++;
			 j--;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		    if(c[i][j]=='.')
		  {// System.out.print(i+" "+j);

		    count++;
			//System.out.print("count"+count);
			i++;
			j--;
			if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  while(c[i][j]=='X')
		  {
		     count++;
			 i++;
			 j--;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		 count=0;
		  i=r;
		  j=col;

		  while(c[i][j]=='X')
		  {  //System.out.print(i+" "+j);
		     count++;
			 i--;
			 j++;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		    if(c[i][j]=='.')
		  {// System.out.print(i+" "+j);

		    count++;
			//System.out.print("count"+count);
			i--;
			j++;
			if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  while(c[i][j]=='X')
		  {
		     count++;
			 i--;
			 j++;
			 if(count==5)
			 {
			 System.out.print("YES");
			  return;
			  }
		  }

		  count=0;
		  i=r;
		  j=col;

	   }

   }

}

System.out.print("NO");

}

}

import java.io.*;
import java.util.*;

public class Main {

    public static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) throws Exception {
        //int n = scan.nextInt();
        char[][] c = new char[10][10];
        for (int i = 0; i < 10; i++) {
            c[i] = scan.next().toCharArray();
        }
        for (int i = 0; i < 10; i++) {

            for (int j = 0; j < 10; j++) {
                int dem1 = 0, dem2 = 0, dem3 = 0, dem4 = 0;
                for (int k = 0; k < 5; k++) {
                    try {
                        if (c[i][j + k] == 'X') {
                            dem1++;
                        } else if (c[i][j + k] == 'O') {
                            dem1--;
                        }
                    } catch (Exception e) {
                        dem1--;
                    }
                    try {
                        if (c[i + k][j] == 'X') {
                            dem2++;
                        } else if (c[i + k][j] == 'O') {
                            dem2--;
                        }
                    } catch (Exception e) {
                        dem2--;
                    }
                    try {
                        if (c[i + k][j + k] == 'X') {
                            dem3++;
                        } else if (c[i + k][j + k] == 'O') {
                            dem3--;
                        }
                    } catch (Exception e) {
                        dem3--;
                    }
                    try {
                        if (c[i + k][j - k] == 'X') {
                            dem4++;
                        } else if (c[i + k][j - k] == 'O') {
                            dem4--;
                        }
                    } catch (Exception e) {
                        dem4--;
                    }
                }
                if (dem1 == 4 || dem2 == 4 || dem3 == 4 || dem4 == 4) {
                    System.out.println("YES");
                    return;
                }

            }
        }
        System.out.println("NO");
    }

}

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import javax.swing.plaf.synth.SynthSpinnerUI;

public class Main2 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[][] field = new int[10][10];
		for(int i = 0; i < 10; i++) {
			String s = sc.next();
			for(int j = 0; j < 10; j++) {
				char c = s.charAt(j);
				if(c == '.') {
					field[i][j] = 2;
				} else if(c == 'X') field[i][j] = 1;

			}
		}
		boolean pos = false;
		for(int i = 0; i < 10; i++) {
			for(int j = 0; j < 10; j++) {
				if(pos(field, i, j)) pos = true;
			}
		}
		if(pos) System.out.println("YES");
		else System.out.println("NO");
	}

	static boolean pos(int[][] field, int i, int j) {
		boolean pos = false;
		if(i <= 5) {
			int a = 0;
			int b = 0;
			for(int k = i; k < i+5; k++) {
				if(field[k][j] == 1) a++;
				if(field[k][j] == 2) b++;
			}
			if(b == 1 && a == 4) pos = true;
			if(a == 5) pos = true;
		}
		if(j <= 5) {
			int a = 0;
			int b = 0;
			for(int k = j; k < j+5; k++) {
				if(field[i][k] == 1) a++;
				if(field[i][k] == 2) b++;
			}
			if(b == 1 && a == 4) pos = true;
			if(a == 5) pos = true;
		}
		if(i <= 5 && j <= 5) {
			int a = 0;
			int b = 0;
			for(int k = 0; k < 5; k++) {
				if(field[i+k][j+k] == 1) a++;
				if(field[i+k][j+k] == 2) b++;
			}
			if(b == 1 && a == 4) pos = true;
			if(a == 5) pos = true;
		}
		if(i >= 4 && j <= 5) {
			int a = 0;
			int b = 0;
			for(int k = 0; k < 5; k++) {
				if(field[i-k][j+k] == 1) a++;
				if(field[i-k][j+k] == 2) b++;
			}
			if(b == 1 && a == 4) pos = true;
			if(a == 5) pos = true;
		}

		return pos;
	}
}

import java.util.Scanner;

/**
 * Created by Berry on 17-7-20.
 */
public class Binaryprotocol {

    public static void main(String[] args){
        Scanner stdin = new Scanner( System.in );
        String[] matrix = new String[10];
        for( int i = 0; i < 10; i++ ){
            matrix[i] = stdin.next();
        }

        for( int i = 0; i < 10; i++ ){
            String str = matrix[i];
            for( int j = 0; j < 10; j++ ){
                char c = str.charAt(j);
                if( c == '.' ) {
                    int left = findLeft(i, j, matrix);
                    int right = findRight(i, j, matrix);
                    int leftUp = findLeftUp(i, j, matrix);
                    int rightDown = findRightDown(i, j, matrix);
                    int rightUp = findRightUp(i, j, matrix);
                    int leftDown = findLeftDown(i, j, matrix);

                    if (left + right >= 4 || leftUp + rightDown >= 4 || rightUp + leftDown >= 4) {
                        System.out.println("YES");
                    }
                }
            }
        }

        System.out.println("NO");

    }

    private static int findLeft(int x, int y, String[] matrix){
        int count = 0;
        y--;
        while( y >= 0 && matrix[x].charAt(y) == 'X'){
            count++;
            y--;
        }

        return count;
    }

    private static int findRight(int x, int y, String[] matrix){
        int count = 0;
        y++;
        while( y < 10 && matrix[x].charAt(y) == 'X'){
            count++;
            y++;
        }

        return count;
    }

    private static int findUp(int x, int y, String[] matrix){
        int count = 0;
        x--;
        while( x >= 0 && matrix[x].charAt(y) == 'X' ){
            count++;
            x--;
        }

        return count;
    }

    private static int findDown(int x, int y, String[] matrix){
        int count = 0;
        x++;
        while( x < 10 && matrix[x].charAt(y) == 'X' ){
            count++;
            x++;
        }

        return count;
    }

    private static int findLeftUp(int x, int y, String[] matrix){
        int count = 0;
        x--;
        y--;
        while( x >= 0 && y >= 0 && matrix[x].charAt(y) == 'X'){
            count++;
            x--;
            y--;
        }

        return count;
    }

    private static int findRightDown(int x, int y, String[] matrix){
        int count = 0;
        x++;
        y++;
        while( x < 10 && y < 10 && matrix[x].charAt(y) == 'X'){
            count++;
            x++;
            y++;
        }

        return count;
    }

    private static int findRightUp(int x, int y, String[] matrix){
        int count = 0;
        x--;
        y++;
        while( x >= 0 && y < 10 && matrix[x].charAt(y) == 'X'){
            count++;
            x--;
            y++;
        }

        return count;
    }

    private static int findLeftDown(int x, int y, String[] matrix){
        int count = 0;
        x++;
        y--;
        while( x < 10 && y >= 0 && matrix[x].charAt(y) == 'X'){
            count++;
            x++;
            y--;
        }

        return count;
    }
}

//package Jul22;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

/**
 * Created by kandarp.jo on 22/07/17.
 */
public class B {
    public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    public static PrintWriter out = new PrintWriter(System.out);
    public static void main(String cd[]) throws  Exception{
        char array[][] = new char[10][10];
        for(int i=0;i<10;i++){
            String s = in.readLine();
            for(int j=0;j<10;j++){
                array[i][j] = s.charAt(j);
            }
        }
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                if(array[i][j]=='.'){
                    array[i][j] = 'X';
                    if(check(array)){
                        out.println("YES");
                        out.close();
                        System.exit(0);
                    }
                    array[i][j]='.';
                }
            }
        }
        out.println("NO");
        out.close();

    }
    public static boolean check(char[][] array){
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                char tmp ='X';
                int count =0;
                for(int k=0;k<5;k++){
                    if(j+k <10 && array[i][j+k]==tmp){
                        count++;
                    }
                }
                if(count == 5){
                    return true;
                }
                count=0;
                for(int k=0;k<5;k++){
                    if(i+k<10 && array[i+k][j]==tmp)
                        count++;
                }
                if(count==5){
                    return true;
                }
                for(int k=0;k<5;k++){
                    if(i+k<10 && j+k<10 && array[i+k][j+k]==tmp){
                        count++;
                    }
                }
                if(count==5){
                    return true;
                }
            }

        }
        return false;
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class BinaryProb {
	public static PrintWriter out;

	   //-----------MyScanner class for faster input----------
	   public static class MyScanner {
	      BufferedReader br;
	      StringTokenizer st;

	      public MyScanner() {
	         br = new BufferedReader(new InputStreamReader(System.in));
	      }

	      String next() {
	          while (st == null || !st.hasMoreElements()) {
	              try {
	                  st = new StringTokenizer(br.readLine());
	              } catch (IOException e) {
	                  e.printStackTrace();
	              }
	          }
	          return st.nextToken();
	      }

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

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

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

	      String nextLine(){
	          String str = "";
		  try {
		     str = br.readLine();
		  } catch (IOException e) {
		     e.printStackTrace();
		  }
		  return str;
	      }

	   }
	   public static void main(String args[]) throws Exception {

			class prob {
				int calcd(String[] in, int i, int j) {
					int count = 0;
					int left = i - 1;
					int right = j - 1;
					while (left >= 0 && right >= 0) {
						if (in[left].charAt(right) != 'X') {
							break;
						}
						++count;
						--left;
						--right;
					}

					int left2 = i + 1;
					int right2 = j + 1;
					while (left2 < 10 && right2 < 10) {
						if (in[left2].charAt(right2) != 'X') {
							break;
						}
						++count;
						++left2;
						++right2;
					}

					return count;
				}
				int calc(String[] in, int i, int j) {
					int count = 0;
					int left = j - 1;
					int right = j + 1;
					while (left >= 0) {
						if (in[i].charAt(left) != 'X') {
							break;
						}
						++count;
						--left;
					}
					while (right < 10) {
						if (in[i].charAt(right) != 'X') {
							break;
						}

						++count;
						++right;
					}

					int count2 = 0;
					int top = i - 1;
					int bottom = i + 1;
					while (top >= 0) {
						if (in[top].charAt(j) != 'X') {
							break;
						}
						++count2;
						--top;
					}
					while (bottom < 10) {
						if (in[i].charAt(bottom) != 'X') {
							break;
						}

						++count2;
						++bottom;
					}

					return Math.max(count, count2);
				}
				public void solve() {
					MyScanner s = new MyScanner();
					String[] in = new String[10];
					for (int i = 0;i < 10; ++i) {
						in[i] = s.next();
					}
					for (int i = 0; i < 10; ++i) {
						for (int j = 0; j < 10; ++j) {
							if (in[i].charAt(j) == '.') {
								if (calc(in, i, j) >= 4 || calcd(in, i, j) >= 4) {
									System.out.print("YES");
									return;
								}
							}
						}
					}

					System.out.print("NO");

				}
			}
			prob s = new prob();
			s.solve();
		}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Solution {

    static void transposition(char [][]mass){
        char temp;
        for(int i = 0; i < 10; i ++){// reverse
            for(int j = 0; j < 10; j ++){
                if(i <= j){
                    temp = mass[i][j];
                    mass[i][j] = mass[j][i];
                    mass[j][i] = temp;
                }
            }
        }
    }

    static void reverseMass(char [][]mass){
        char temp;
        char [][] newMass = new char[10][10];
        for(int i = 0; i < 10; i ++){// reverse
            for(int j = 0; j < 10; j ++){
                //temp = mass[i][j];
                newMass[i][j] = mass[9-j][i];
                //mass[9-j][i] = temp;
            }
        }/*
        System.out.println("reverse: ");
        for(int i = 0; i < 10; i ++){// reverse
            for(int j = 0; j < 10; j ++){
                System.out.print(newMass[i][j]);
            }
            System.out.println();
        }*/
    }

    static int proverka_line(char [][]mass){
        int isRow = 0;
        int st_i, st_j;
        int countX, countP;
        for(int i = 0; i < 10; i ++){
                st_i = i;
                for(int j = 0; j < 6; j ++){
                    st_j = j;
                    countX = 0;
                    countP = 0;
                    for(int k = 0; k < 5; k ++){
                        if(mass[st_i][st_j] == 'X'){
                            countX++;
                        }
                        else if(mass[st_i][st_j] == '.'){
                            countP++;
                        }
                        st_j++;
                    }
                    if(countX == 4 && countP == 1){
                        isRow = 1;
                        //System.out.println("YES_line");
                    }
                }
        }
        return isRow;
    }

    static int proverka_diagonal(char [][]mass){
        int isRow = 0, first_i, first_j, countX, countP;
        for(int i = 4; i < 10; i ++){
            for(int j = 0; j < 6; j ++){
                first_i = i;
                first_j = j;
                countX = 0;
                countP = 0;
                for(int k = 0; k < 5; k ++){
                    if(mass[first_i][first_j] == 'X'){
                        countX++;
                    }
                    else if(mass[first_i][first_j] == '.'){
                        countP++;
                    }
                    first_i--; first_j++;
                }
                if(countX == 4 && countP == 1){
                    isRow = 1;
                    //System.out.println("YES_diag");
                }
            }
        }
        return isRow;
    }

    public static void main(String[] args) throws IOException {

        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

        char [][]mass = new char[10][];
        for(int i = 0; i < 10; i ++){
                    mass[i] = input.readLine().toCharArray();
        }

        Integer vert = 0, horiz = 0;
        int leftRightDiag = 0, rightLeftDiag = 0;

        for(int q = 0; q < 2; q ++){
            if(q == 0){ //horiz
                horiz = proverka_line(mass);
                leftRightDiag = proverka_diagonal(mass);
            }
            if(q == 1){ //vert
                reverseMass(mass);
                vert = proverka_line(mass);
                rightLeftDiag = proverka_diagonal(mass);
            }
        }
        if(horiz == 1 || leftRightDiag == 1 || vert == 1 || rightLeftDiag == 1){
            System.out.println("YES");
        }
        else System.out.println("NO");
        //System.out.println("horiz = " + horiz + " lrDiag = " + leftRightDiag + " vert = " + vert + " rlDiag = " + rightLeftDiag);

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class B {

	static int N;
	static char[][] grid;

	public static void main(String[] args) throws Exception
	{
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		N = 10;
		grid = new char[N][N];
		for(int i = 0; i < N; i++)
			grid[i] = sc.next().toCharArray();
		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++)
				if(grid[i][j] == '.')
				{
					grid[i][j] = 'X';
					if(row() || col() || diag1() || diag2())
					{
						out.println("YES");
						out.flush();
						return;
					}
					grid[i][j] = '.';
				}
		out.println("NO");
		out.flush();
		out.close();
	}

	static boolean row()
	{
		int max = 0;
		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++)
			{
				int cur = 0;
				for(int k = j; k < N; k++)
					if(grid[i][k] == 'X')
						cur++;
					else
					{
						max = Math.max(max, cur);
						cur = 0;
					}
			}
		return max >= 5;
	}

	static boolean col()
	{
		int max = 0;
		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++)
			{
				int cur = 0;
				for(int k = i; k < N; k++)
					if(grid[k][j] == 'X')
						cur++;
					else
					{
						max = Math.max(max, cur);
						cur = 0;
					}
			}
		return max >= 5;
	}

	static boolean diag1()
	{
		int max = 0;
		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++)
			{
				int cur = 0;
				for(int k = i, l = j; k < N && l < N; k++, l++)
					if(grid[k][l] == 'X')
						cur++;
					else
					{
						max = Math.max(max, cur);
						cur = 0;
					}
			}
		return max >= 5;
	}

	static boolean diag2()
	{
		int max = 0;
		for(int i = 0; i < N; i++)
			for(int j = 0; j < N; j++)
			{
				int cur = 0;
				for(int k = i, l = j; k < N && l >= 0; k++, l--)
					if(grid[k][l] == 'X')
						cur++;
					else
					{
						max = Math.max(max, cur);
						cur = 0;
					}
			}
		return max >= 5;
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {br = new BufferedReader(new InputStreamReader(system));}
		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public String nextLine()throws IOException{return br.readLine();}
		public int nextInt() throws IOException {return Integer.parseInt(next());}
		public double nextDouble() throws IOException {return Double.parseDouble(next());}
		public char nextChar()throws IOException{return next().charAt(0);}
		public Long nextLong()throws IOException{return Long.parseLong(next());}
		public boolean ready() throws IOException{return br.ready();}
		public void waitForInput(){for(long i = 0; i < 3e9; i++);}
	}
}

import java.io.*;
import java.util.*;
@SuppressWarnings("unused")
public class Solution { //Название класса здесь
	private static boolean IOTypeIsFile = false; //Вид ввода/вывода. true-через файл. false-через консоль.
	private static String FileInput = ""; //Название файла ввода
	private static String FileOutput = "name.out";//Название файла вывода
	private static Scanner in;
	private static PrintStream out, err;
	private static String ts(Object a) {
		return String.valueOf(a);
	}
	private static int ti(String a) {
		return Integer.valueOf(a);
	}
	private static double td(String a) { return Double.valueOf(a); }
	private static int[] arrayI(int n) {
		int[] ans = new int[n];
		for (int i = 0; i < n; ++i) {ans[i] = in.nextInt(); }
		return ans;
	}
	private static String[] arrayS(int n) {
		String[] ans = new String[n];
		for (int i = 0; i < n; ++i) { ans[i] = in.next(); }
		return ans;
	}

	private static double[] arrayD(int n) {
		double[] ans = new double[n];
		for (int i = 0; i < n; ++i) { ans[i] = in.nextDouble(); }
		return ans;
	}

	private static void SomeVeryLargeUndUselessFunctionName(){if(!IOTypeIsFile){ err.print(FileInput + FileOutput);}}

	public static void main(String[] args) {
		err = new PrintStream(System.err);
		if (IOTypeIsFile) {
			File f = new File(FileInput);
			try {
				in = new Scanner(f);
				out = new PrintStream(FileOutput);
			} catch (FileNotFoundException var3) {
				System.err.println("404");return;
			}
		} else {
			in = new Scanner(System.in);
			out = new PrintStream(System.out);
		}
		run();
		in.close();
		out.close();
	}

	//Код пишут отсюда
	private static void run() {
		char[][] table=new char[10][10];
		for (int i=0;i<10;i++){
			table[i]=in.nextLine().toCharArray();
		}
		for (int y=0;y<10;y++){
			for (int x=0;x<10;x++){
				if (table[y][x]=='.'){
					int am=1;
					for (int i=x-1;i>=0;i--){
						if (table[y][i]=='X'){am++;}
						else {break;}
					}
					for (int i=x+1;i<10;i++){
						if (table[y][i]=='.'){break;}
						else if (table[y][i]=='X'){am++;}
					}
					if (am>=5){out.println("YES");return;}
					am=0;
					for (int i=y-1;i>=0;i--){
						if (table[i][x]=='X'){am++;}
						else {break;}
					}
					for (int i=y+1;i<10;i++){
						if (table[i][x]=='X'){am++;}
						else {break;}
					}
					if (am>=5){out.println("YES");return;}
					am=0;
					for (int i=y-1,j=x-1;(i>=0)&&(j>=0);i--,j--){
						if (table[i][j]=='X'){am++;}
						else {break;}
					}
					for (int i=y+1,j=x+1;(i<10)&&(j<10);i++,j++){
						if (table[i][j]=='X'){am++;}
						else {break;}
					}
					if (am>=5){out.println("YES");return;}
				}
			}
		}
		out.println("NO");
	}
}

import java.io.*;
import java.util.*;
@SuppressWarnings("unused")
public class Solution { //Название класса здесь
	private static boolean IOTypeIsFile = false; //Вид ввода/вывода. true-через файл. false-через консоль.
	private static String FileInput = ""; //Название файла ввода
	private static String FileOutput = "name.out";//Название файла вывода
	private static Scanner in;
	private static PrintStream out, err;
	private static String ts(Object a) {
		return String.valueOf(a);
	}
	private static int ti(String a) {
		return Integer.valueOf(a);
	}
	private static double td(String a) { return Double.valueOf(a); }
	private static int[] arrayI(int n) {
		int[] ans = new int[n];
		for (int i = 0; i < n; ++i) {ans[i] = in.nextInt(); }
		return ans;
	}
	private static String[] arrayS(int n) {
		String[] ans = new String[n];
		for (int i = 0; i < n; ++i) { ans[i] = in.next(); }
		return ans;
	}

	private static double[] arrayD(int n) {
		double[] ans = new double[n];
		for (int i = 0; i < n; ++i) { ans[i] = in.nextDouble(); }
		return ans;
	}

	private static void SomeVeryLargeUndUselessFunctionName(){if(!IOTypeIsFile){ err.print(FileInput + FileOutput);}}

	public static void main(String[] args) {
		err = new PrintStream(System.err);
		if (IOTypeIsFile) {
			File f = new File(FileInput);
			try {
				in = new Scanner(f);
				out = new PrintStream(FileOutput);
			} catch (FileNotFoundException var3) {
				System.err.println("404");return;
			}
		} else {
			in = new Scanner(System.in);
			out = new PrintStream(System.out);
		}
		run();
		in.close();
		out.close();
	}

	//Код пишут отсюда
	private static void run() {
		char[][] table=new char[10][10];
		for (int i=0;i<10;i++){
			table[i]=in.nextLine().toCharArray();
		}
		for (int y=0;y<10;y++){
			for (int x=0;x<10;x++){
				if (table[y][x]=='.'){
					int am=1;
					for (int i=x-1;i>=0;i--){
						if (table[y][i]=='X'){am++;}
						else {break;}
					}
					for (int i=x+1;i<10;i++){
						if (table[y][i]=='.'){break;}
						else if (table[y][i]=='X'){am++;}
					}
					if (am>=5){out.println("YES");return;}
					am=1;
					for (int i=y-1;i>=0;i--){
						if (table[i][x]=='X'){am++;}
						else {break;}
					}
					for (int i=y+1;i<10;i++){
						if (table[i][x]=='X'){am++;}
						else {break;}
					}
					if (am>=5){out.println("YES");return;}
					am=1;
					for (int i=y-1,j=x-1;(i>=0)&&(j>=0);i--,j--){
						if (table[i][j]=='X'){am++;}
						else {break;}
					}
					for (int i=y+1,j=x+1;(i<10)&&(j<10);i++,j++){
						if (table[i][j]=='X'){am++;}
						else {break;}
					}
					if (am>=5){out.println("YES");return;}
					am=1;
					for (int i=y-1,j=x+1;(i>=0)&&(j<10);i--,j++){
						if (table[i][j]=='X'){am++;}
						else {break;}
					}
					for (int i=y-1,j=x+1;(i>0)&&(j<10);i--,j++){
						if (table[i][j]=='X'){am++;}
						else {break;}
					}
					if (am>=5){out.println("YES");return;}
				}
			}
		}
		out.println("NO");
	}
}

import java.util.Scanner;

public class FiveInRow {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        boolean checker = false;
        String[] array = new String[10];
        for (int i = 0; i < 10; i++){
            array[i] = sc.nextLine();
            if (!checker) {
                checker = checkTheLine(array[i]);
            }
        }
        if (checker || verticalLinesBuilder(array)){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
    public static boolean checkTheLine(String line){
        if (line.contains(".XXXX") || line.contains("X.XXX") ||
                line.contains("XX.XX") || line.contains("XXX.X") || line.contains("XXXX.")){
            return true;
        }
        return false;
    }

    public static boolean verticalLinesBuilder(String[] array) {
        String line = "";
        int i = 10;
        while (--i >= 0) {
            for (int j = 0; j < 10; j++) {
                line += array[j].charAt(i);
            }
            if (checkTheLine(line)){
                return true;
            } else {
                if (upDiagonalLinesBuilder(array) || downDiagonalLinesBuilder(array)){
                    return true;
                }
            }
        }
        return false;
    }

    public static boolean upDiagonalLinesBuilder(String[] array){
        int temp = 3;
        while (++temp <=9){
            String line = "";
            for (int i = 0; i <=temp; i++){
                line +=array[i].charAt(temp-i);
            }
            if (checkTheLine(line)){
                return true;
            }
        }
        temp = 15;
        while (--temp >=10){
            String line = "";
            for (int i = 9; i >=temp-9; i--){
                line +=array[i].charAt(temp-i);
            }
            if (checkTheLine(line)){
                return true;
            }
        }
        return false;
    }

    public static boolean downDiagonalLinesBuilder(String[] array) {
        int temp = 6;
        while (--temp >=0) {
            String line = "";
            for (int i = temp; i <= 9; i++) {
                line += array[i].charAt(i-temp);
            }
            if (checkTheLine(line)) {
                return true;
            }
        }
        temp = 6;
        while (--temp>0) {
            String line = "";
            for (int i = 0; i <=9-temp; i++) {
                line += array[i].charAt(temp + i);
            }
            if (checkTheLine(line)) {
                return true;
            }
        }
        return false;
    }
}

import java.util.Scanner;

public class MainB {
//	static boolean lalala = false;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[][] array = new char[10][10];
		for(int i=0; i<10; i++) {
			String str = in.nextLine();
			for(int j=0; j<10; j++) {
				array[i][j] = str.charAt(j);
			}
		}
		for(int i=0; i<10; i++) {
			for(int j=0; j<10; j++) {
//				lalala = false;
				if(array[i][j] == '.' && !isAlone(array, i, j)) {
					array[i][j] = 'X';
					for(int m=0; m<10; m++) {
						for(int n=0; n<10; n++) {
							if(array[m][n] == 'X') {
//								if(m == 0 && n == 3) {
//									System.out.println("-------");
//								}
								if(hasFiveInVer(array, m, n) || hasFiveInHor(array, m, n) || hasFiveInDia1(array, m, n) || hasFiveInDia2(array, m, n)) {
									System.out.println("YES");
									in.close();
									return;
								}
							}
						}
					}
					array[i][j] = '.';
				}
			}
		}
		System.out.println("NO");

		in.close();
	}

	public static boolean isAlone(char[][] array, int x, int y) {
		if(x > 0 && x < 9 && y > 0 && y < 9) {
			if(array[x-1][y-1] == 'X' || array[x-1][y] == 'X' || array[x-1][y+1] == 'X'
					|| array[x][y-1] == 'X' || array[x][y+1] == 'X'
					|| array[x+1][y-1] == 'X' || array[x+1][y] == 'X' || array[x+1][y+1] == 'X') {
//				if(x == 0 && y == 9) {
//					System.out.println("===========");
//					lalala = true;
//				}
//				return false;
			}
		}else if(x == 0 && y > 0 && y < 9) {
			if(array[x][y-1] == 'X' || array[x][y+1] == 'X' || array[x+1][y-1] == 'X' || array[x+1][y] == 'X' || array[x+1][y+1] == 'X') {
				return false;
			}
		}else if(x == 9 && y > 0 && y < 9) {
			if(array[x][y-1] == 'X' || array[x][y+1] == 'X' || array[x-1][y-1] == 'X' || array[x-1][y] == 'X' || array[x-1][y+1] == 'X') {
				return false;
			}
		}else if(y == 0 && x > 0 && x < 9) {
			if(array[x-1][y] == 'X' || array[x+1][y] == 'X' || array[x+1][y+1] == 'X' || array[x][y+1] == 'X' || array[x-1][y+1] == 'X') {
				return false;
			}
		}else if(y == 9 && x > 0 && x < 9) {
			if(array[x-1][y] == 'X' || array[x+1][y] == 'X' || array[x+1][y-1] == 'X' || array[x][y-1] == 'X' || array[x-1][y-1] == 'X') {
				return false;
			}
		}else if(x == 0 && y == 0) {
			if(array[x][y+1] == 'X' || array[x+1][y] == 'X' || array[x+1][y+1] == 'X') {
				return false;
			}
		}else if(x == 9 && y == 9) {
			if(array[x][y-1] == 'X' || array[x-1][y] == 'X' || array[x-1][y-1] == 'X') {
				return false;
			}
		}else if(x == 0 && y == 9) {
			if(array[x][y-1] == 'X' || array[x+1][y] == 'X' || array[x+1][y-1] == 'X') {
				return false;
			}
		}else if(x == 9 && y == 0) {
			if(array[x][y+1] == 'X' || array[x-1][y] == 'X' || array[x-1][y+1] == 'X') {
				return false;
			}
		}
		return true;
	}

	public static boolean hasFiveInHor(char[][] array, int x, int y) {
		if(y > 5)
			return false;
		for(int j = y; j < y+5; j++) {
			if(array[x][j] != 'X')
				return false;
		}
		return true;
	}

	public static boolean hasFiveInVer(char[][] array, int x, int y) {
		if(x > 5)
			return false;
		for(int i = x; i < x+5; i++) {
//			if(lalala) {
//				System.out.print(array[i][y] + " ");
//			}
			if(array[i][y] != 'X')
				return false;
		}
		return true;
	}

	public static boolean hasFiveInDia1(char[][] array, int x, int y) {
		if(x > 5 || y > 5)
			return false;
		for(int i=0; i<5; i++) {
			if(array[x+i][y+i] != 'X')
				return false;
		}
		return true;
	}

	public static boolean hasFiveInDia2(char[][] array, int x, int y) {
		if(x > 5 || y < 4)
			return false;
		for(int i=0; i<5; i++) {
			if(array[x+i][y-i] != 'X')
				return false;
		}
		return true;
	}

}

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String matrix[] = new String[10];
		for (int i = 0; i < 10; i++) {
			matrix[i] = sc.nextLine();

		}

		System.out.println(process(matrix) ? "YES" : "NO") ;

		sc.close();
	}

	private static boolean process(String[] matrix) {
		for (int i = 0; i < 10; i++) {

			//busca horizontal
			int idx = matrix[i].indexOf("X");

			int aux = idx;
			boolean vert = false;
			while (idx != -1) {

				if (idx > 0) {
					if (matrix[i].charAt(idx-1) == '.') {
						idx--;
					}
				}
				if(busca(matrix[i], idx))
					return true;

				if (i > 0) {
					if (matrix[i-1].charAt(idx) == '.') {
						i--;
						vert = true;
					}
				}
				String str = stringVertical(matrix, i, aux);
				//aux = str.indexOf("X");
				if(busca(str, 0))
					return true;
				if (vert) i++;
				vert = false;

				str = stringDiagonalDireita(matrix, i, aux);
				//aux = str.indexOf("X");
				if(busca(str, 0))
					return true;

				str = stringDiagonalEsquerda(matrix, i, aux);
				//aux = str.indexOf("X");
				if(busca(str, 0))
					return true;

				idx = matrix[i].indexOf("X", aux+1);
				aux = idx;
			}

		}

		return false;
	}

	private static String stringDiagonalEsquerda(String[] matrix, int i, int idx) {
		StringBuilder str = new StringBuilder();

		if ((i > 0) && (idx < 9)) {
			char c = matrix[i-1].charAt(idx+1);
			if (c == '.') {
				str.append(c);
			}

			str.append(c);
		}

		for (int j = i; j < 10; j++) {
			if(idx >= 0)
				str.append(matrix[j].charAt(idx--));
			else break;
		}

		return str.toString();
	}

	private static String stringDiagonalDireita(String[] matrix, int i, int idx) {
		StringBuilder str = new StringBuilder();

		if ((i > 0) && (idx > 0)) {
			char c = matrix[i-1].charAt(idx-1);
			if (c == '.') {
				str.append(c);
			}

		}
		for (int j = i; j < 10; j++) {
			if (idx < 10) {
				str.append(matrix[j].charAt(idx++));
			} else break;
		}

		return str.toString();
	}

	private static String stringVertical(String[] matrix, int i, int idx) {
		StringBuilder str = new StringBuilder();
		for (int j = i; j < 10; j++) {
			str.append(matrix[j].charAt(idx));
		}
		return str.toString();
	}

	private static boolean busca(String matrix, int idx) {
		boolean usedDot = false;
		int size = 1;

		if ((idx == -1) || (matrix.length() < 5)){
			return false;
		}

		for (int k = idx+1; k < 10; k++) {
			if (matrix.charAt(k) == 'O') {
				break;
			} else if (matrix.charAt(k) == '.') {
				if (!usedDot)
					usedDot = true;
				else break;
			}
			size++;

			if (size == 5) return true;
		}

		return false;
	}

}

import java.io.*;
import java.util.StringTokenizer;
public class FIVEROW {
	public static void main(String args[])
	throws IOException
	{
		Reader.init(System.in);
		char ch[][]=new char[10][10];
		for(int i=0;i<10;i++)
		{
			String S=Reader.next();
			for(int j=0;j<10;j++)
			{
				ch[i][j]=S.charAt(j);
			}
		}
		int row=0;
		int column=0;
		boolean flag=false;
		for(row=0;row<=5;row++)
		{
			for(column=0;column<=3;column++)
			{
				if(ch[row][column]=='X')
				{
					int countX=1;
					int space=0;
					for(int a=1;a<5;a++)
					{
						if(ch[row][column+a]=='X')
						{
							countX++;
						}
						else if(ch[row][column+a]=='.')
						{
							space++;
						}
						else
						{
							break;
						}
					}
					if(countX==4 && space==1)
					{
						flag=true;
						break;
					}
					space=0;
					countX=1;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column]=='X')
						{
							countX++;
						}
						else if(ch[row+a][column]=='.')
						{
							space++;
						}
						else
						{
							break;
						}
					}
					if(countX==4 && space==1)
					{
						flag=true;
						break;
					}
					space=0;
					countX=1;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column+a]=='X')
						{
							countX++;
						}
						else if(ch[row+a][column+a]=='.')
						{
							space++;
						}
						else
						{
							break;
						}
					}
					if(countX==4 && space==1)
					{
						flag=true;
						break;
					}
				}
				else if(ch[row][column]=='.')
				{
					int countX=0;
					for(int a=1;a<5;a++)
					{
						if(ch[row][column+a]=='X')
						{
							countX++;
						}
						else
						{
							break;
						}
					}
					if(countX==4)
					{
						flag=true;
						break;
					}
					countX=0;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column]=='X')
						{
							countX++;
						}
						else
						{
							break;
						}
					}
					if(countX==4)
					{
						flag=true;
						break;
					}
					countX=1;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column+a]=='X')
						{
							countX++;
						}
						else
						{
							break;
						}
					}
					if(countX==4)
					{
						flag=true;
						break;
					}
				}

			}
			if(flag==true)
				break;
			for(column=4;column<=5;column++)
			{
				if(ch[row][column]=='X')
				{
					int countX=1;
					int space=0;
					for(int a=1;a<5;a++)
					{
						if(ch[row][column+a]=='X')
						{
							countX++;
						}
						else if(ch[row][column+a]=='.')
						{
							space++;
						}
						else
						{
							break;
						}
					}
					if(countX==4 && space==1)
					{
						flag=true;
						break;
					}
					space=0;
					countX=1;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column]=='X')
						{
							countX++;
						}
						else if(ch[row+a][column]=='.')
						{
							space++;
						}
						else
						{
							break;
						}
					}
					if(countX==4 && space==1)
					{
						flag=true;
						break;
					}
					space=0;
					countX=1;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column+a]=='X')
						{
							countX++;
						}
						else if(ch[row+a][column+a]=='.')
						{
							space++;
						}
						else
						{
							break;
						}
					}
					if(countX==4 && space==1)
					{
						flag=true;
						break;
					}
					space=0;
					countX=1;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column-a]=='X')
						{
							countX++;
						}
						else if(ch[row+a][column-a]=='.')
						{
							space++;
						}
						else
						{
							break;
						}
					}
					if(countX==4 && space==1)
					{
						flag=true;
						break;
					}
				}
				else if(ch[row][column]=='.')
				{
					int countX=1;
					for(int a=1;a<5;a++)
					{
						if(ch[row][column+a]=='X')
						{
							countX++;
						}
						else
						{
							break;
						}
					}
					if(countX==4)
					{
						flag=true;
						break;
					}
					countX=1;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column]=='X')
						{
							countX++;
						}
						else
						{
							break;
						}
					}
					if(countX==4)
					{
						flag=true;
						break;
					}
					countX=1;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column+a]=='X')
						{
							countX++;
						}
						else
						{
							break;
						}
					}
					if(countX==4)
					{
						flag=true;
						break;
					}
					countX=1;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column-a]=='X')
						{
							countX++;
						}
						else
						{
							break;
						}
					}
					if(countX==4)
					{
						flag=true;
						break;
					}
				}
			}
			if(flag==true)
				break;
			for(column=6;column<=9;column++)
			{
				if(ch[row][column]=='X')
				{
					int countX=1;
					int space=0;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column]=='X')
						{
							countX++;
						}
						else if(ch[row+a][column]=='.')
						{
							space++;
						}
						else
						{
							break;
						}
					}
					if(countX==4 && space==1)
					{
						flag=true;
						break;
					}
					space=0;
					countX=1;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column-a]=='X')
						{
							countX++;
						}
						else if(ch[row+a][column-a]=='.')
						{
							space++;
						}
						else
						{
							break;
						}
					}
					if(countX==4 && space==1)
					{
						flag=true;
						break;
					}
				}
				else if(ch[row][column]=='.')
				{
					int countX=1;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column]=='X')
						{
							countX++;
						}
						else
						{
							break;
						}
					}
					if(countX==4 )
					{
						flag=true;
						break;
					}
					countX=1;
					for(int a=1;a<5;a++)
					{
						if(ch[row+a][column-a]=='X')
						{
							countX++;
						}
						else
						{
							break;
						}
					}
					if(countX==4)
					{
						flag=true;
						break;
					}
				}
			}
			if(flag==true)
				break;
		}
		if(flag==true)
			System.out.println("YES");
		else
		{
			for(row=6;row<=9;row++)
			{
				for(column=0;column<=5;column++)
				{
					if(ch[row][column]=='X')
					{
						int countX=1;
						int space=0;
						for(int a=1;a<5;a++)
						{
							if(ch[row][column+a]=='X')
							{
								countX++;
							}
							else if(ch[row][column+a]=='.')
							{
								space++;
							}
							else
							{
								break;
							}
						}
						if(countX==4 && space==1)
						{
							flag=true;
							break;
						}
					}
					else if(ch[row][column]=='.')
					{
						int countX=1;
						for(int a=1;a<5;a++)
						{
							if(ch[row][column+a]=='X')
							{
								countX++;
							}
							else
							{
								break;
							}
						}
						if(countX==4)
						{
							flag=true;
							break;
						}
					}
				}
			}
			if(flag==true)
				System.out.println("YES");
			else
				System.out.println("NO");
		}
	}
}
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine() );
        }
        return tokenizer.nextToken();
    }

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

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

import java.util.Scanner;

public class MainB {
//	static boolean lalala = false;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[][] array = new char[10][10];
		for(int i=0; i<10; i++) {
			String str = in.nextLine();
			for(int j=0; j<10; j++) {
				array[i][j] = str.charAt(j);
			}
		}
		for(int i=0; i<10; i++) {
			for(int j=0; j<10; j++) {
//				lalala = false;
				if(array[i][j] == '.' && !isAlone(array, i, j)) {
					array[i][j] = 'X';
					for(int m=0; m<10; m++) {
						for(int n=0; n<10; n++) {
							if(array[m][n] == 'X') {
//								if(m == 0 && n == 3) {
//									System.out.println("-------");
//								}
								if(hasFiveInVer(array, m, n) || hasFiveInHor(array, m, n) || hasFiveInDia1(array, m, n) || hasFiveInDia2(array, m, n)) {
									System.out.println("YES");
									in.close();
									return;
								}
							}
						}
					}
					array[i][j] = '.';
				}
			}
		}
		System.out.println("NO");

		in.close();
	}

	public static boolean isAlone(char[][] array, int x, int y) {
		if(x > 0 && x < 9 && y > 0 && y < 9) {
			if(array[x-1][y-1] == 'X' || array[x-1][y] == 'X' || array[x-1][y+1] == 'X'
					|| array[x][y-1] == 'X' || array[x][y+1] == 'X'
					|| array[x+1][y-1] == 'X' || array[x+1][y] == 'X' || array[x+1][y+1] == 'X') {
//				if(x == 1 && y == 3) {
//					System.out.println("===========");
//					lalala = true;
//				}
				return false;
			}
		}else if(x == 0 && y > 0 && y < 9) {
			if(array[x][y-1] == 'X' || array[x][y+1] == 'X' || array[x+1][y-1] == 'X' || array[x+1][y] == 'X' || array[x+1][y+1] == 'X') {
				return false;
			}
		}else if(x == 9 && y > 0 && y < 9) {
			if(array[x][y-1] == 'X' || array[x][y+1] == 'X' || array[x-1][y-1] == 'X' || array[x-1][y] == 'X' || array[x-1][y+1] == 'X') {
				return false;
			}
		}else if(y == 0 && x > 0 && x < 9) {
			if(array[x-1][y] == 'X' || array[x+1][y] == 'X' || array[x+1][y+1] == 'X' || array[x][y+1] == 'X' || array[x-1][y+1] == 'X') {
				return false;
			}
		}else if(y == 9 && x > 0 && x < 9) {
			if(array[x-1][y] == 'X' || array[x+1][y] == 'X' || array[x+1][y-1] == 'X' || array[x][y-1] == 'X' || array[x-1][y-1] == 'X') {
				return false;
			}
		}
		return true;
	}

	public static boolean hasFiveInHor(char[][] array, int x, int y) {
		if(y > 5)
			return false;
		for(int j = y; j < y+5; j++) {
			if(array[x][j] != 'X')
				return false;
		}
		return true;
	}

	public static boolean hasFiveInVer(char[][] array, int x, int y) {
		if(x > 5)
			return false;
		for(int i = x; i < x+5; i++) {
//			if(lalala) {
//				System.out.print(array[i][y] + " ");
//			}
			if(array[i][y] != 'X')
				return false;
		}
		return true;
	}

	public static boolean hasFiveInDia1(char[][] array, int x, int y) {
		if(x > 5 || y > 5)
			return false;
		for(int i=0; i<5; i++) {
			if(array[x+i][y+i] != 'X')
				return false;
		}
		return true;
	}

	public static boolean hasFiveInDia2(char[][] array, int x, int y) {
		if(x > 5 || y < 4)
			return false;
		for(int i=0; i<5; i++) {
			if(array[x+i][y-i] != 'X')
				return false;
		}
		return true;
	}

}

import java.util.Scanner;

public class TestThree {

    public static void main(String[] args) {

        Scanner reader = new Scanner(System.in);
        char[][] playField = new char[10][];
        for (int i = 0; i < 10; i++) {
            String row = reader.nextLine();
            playField[i] = row.toCharArray();
        }

        for (int column = 0; column < 10; column++) {

            for (int row = 0; row < 10; row++) {

                if (checkFiveInColumn(playField, column, row) || checkFiveInRow(playField, column, row)
                        ||checkFiveInDiagonalLeft(playField,column,row)||checkFiveInDiagonalRight(playField,column,row)){
                    System.out.println("YES");
                    return;
                }
            }
        }

        System.out.println("NO");
    }

    private static boolean checkFiveInRow(char[][] playField, int column, int row) {

        int count = 0;
        for (int j = row; j < 10; j++) {
            if (playField[column][j] == 'O') {
                break;
            }
            if (playField[column][j] == 'X') {
                count++;
            }
        }
        return count == 4;

    }

    private static boolean checkFiveInColumn(char[][] playField, int column, int row) {

        int count = 0;
        for (int j = column; j < 10; j++) {
            if (playField[j][row] == 'O') {
                break;
            }
            if (playField[j][row] == 'X') {
                count++;
            }
        }
        return count == 4;
    }

    private static boolean checkFiveInDiagonalRight(char[][] playField, int column, int row) {
        if ((row - 4) < 0 || (column + 4) >= 10) {
            return false;
        }

        int count = 0;
        for (int j = 0; j < 5; j++) {
            if (playField[column + j][row - j] == 'O') {
                break;
            }
            if (playField[column + j][row - j] == 'X') {
                count++;
            }
        }

        return count == 4;
    }

    private static boolean checkFiveInDiagonalLeft(char[][] playField, int column, int row) {
        if ((row + 4) >= 10 || (column + 4) >= 10) {
            return false;
        }

        int count = 0;
        for (int j = 0; j < 5; j++) {
            if (playField[column + j][row + j] == 'O') {
                break;
            }
            if (playField[column + j][row + j] == 'X') {
                count++;
            }
        }
        return count == 4;

    }
}

//package codeforces;

import java.util.Scanner;

public class Task2_4 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[][][] arr = new int[10][10][4];
        boolean needToWork = true;
        for (int i = 0; i < 10; i++) {
            String s = in.nextLine();
            if (needToWork) {
                if (s.contains(".XXXX") || s.contains("X.XXX") || (s.contains("XX.XX")) || (s.contains("XXX.X")) || (s.contains("XXXX.")))
                    needToWork = false;
                else for (int j = 0; j < 10; j++) {
                    Character c = s.charAt(j);
                    if (c == 'O') {
                        arr[i][j][0] = -1;
                        arr[i][j][1] = -1;
                        arr[i][j][2] = -1;
                        arr[i][j][3] = 0;
                    } else if (c == 'X') {
                        if (i > 0) {
                            arr[i][j][0] = arr[i - 1][j][0] + 1;
                            if (j > 0) arr[i][j][1] = arr[i - 1][j - 1][1] + 1;
                            if (j < 9) arr[i][j][2] = arr[i - 1][j + 1][2] + 1;
                        } else {
                            arr[i][j][0] = 1;
                            arr[i][j][1] = 1;
                            arr[i][j][2] = 1;
                        }
                        arr[i][j][3] = 1;
                    } else {
                        if (i > 0) {
                            if (arr[i - 1][j][3] == 1) arr[i][j][0] = arr[i - 1][j][0] + 1;
                            else arr[i][j][0] = 0;
                            if (j > 0)
                                if (arr[i - 1][j - 1][3] == 1)
                                    arr[i][j][1] = arr[i - 1][j - 1][1] + 1;
                                else arr[i][j][1] = 0;
                            if (j < 9)
                                if (arr[i - 1][j + 1][3] == 1)
                                    arr[i][j][2] = arr[i - 1][j + 1][2] + 1;
                                else arr[i][j][2] = 0;
                        } else {
                            arr[i][j][0] = 0;
                            arr[i][j][1] = 0;
                            arr[i][j][2] = 0;
                        }
                        arr[i][j][3] = 2;
                    }
                    if ((arr[i][j][0] == 5) || (arr[i][j][1] == 5) || (arr[i][j][2] == 5))
                        needToWork = false;
                }
            }
        }
        if (needToWork) System.out.println("NO");
        else System.out.println("YES");
    }
}

//package virt_contest_27_7_17;

import java.util.Scanner;

public class QB2 {
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		String str;
		char mat[][]=new char[10][10];
		for(int i=0;i<10;++i)
		{
			str=sc.nextLine();
			for(int j=0;j<str.length();++j)
			{
				mat[i][j]=str.charAt(j);
			}
		}
		if(processInput(mat))
		{
			System.out.println("YES");
		}
		else
		{
			System.out.println("NO");
		}
	}
	public static boolean processInput(char mat[][])
	{
		for(int i=0;i<10;++i)
		{
			for(int j=0;j<10;++j)
			{
				if(mat[i][j]=='.' && checkSuccess(mat,i,j))
				{
					return true;
				}
			}
		}
		return false;
	}
	public static boolean checkSuccess(char mat[][],int row,int col)
	{
		int countLeft=0,countRight=0,countTop=0,countBottom=0;
		//checking left
		for(int j=col-1;j>=0;--j)
		{
			if(mat[row][j]=='X')
			{
				countLeft++;
			}
			else
			{
				break;
			}
		}
		//checkingRight
		for(int j=col+1;j<10;++j)
		{
			if(mat[row][j]=='X')
			{
				countRight++;
			}
			else
			{
				break;
			}
		}
		//checking top
		for(int i=row-1;i>=0;--i)
		{
			if(mat[i][col]=='X')
			{
				countTop++;
			}
			else
			{
				break;
			}
		}
		//checking bottom
		for(int i=row+1;i<10;++i)
		{
			if(mat[i][col]=='X')
			{
				countBottom++;
			}
			else
			{
				break;
			}
		}
		if((countTop+countBottom)==4 || (countLeft+countRight)==4)
		{
			return true;
		}
		return false;
	}
}

import java.util.*;
import java.io.*;

public class Main {

    static boolean checker(char[][] arr,int i,int j){
           int rightCount=0,leftCount=0,upCount=0,downCount=0;boolean itself=false,dotH=false,dotV=false;
           if(arr[i][j]=='X') itself=true;
           int k=j+1;
           while(k<10){
               if(arr[i][k]=='X') rightCount++;
               else if (arr[i][k]=='.') {dotH=true; break;}
               else break;
               k++;
           }
           k=j-1;
           while(k>=0){
               if(arr[i][k]=='X') leftCount++;
               else if (arr[i][k]=='.'){dotH=true; break;}
               else break;
               k--;
           }
           k=i-1;
           while(k>=0){
               if(arr[k][j]=='X') upCount++;
               else if (arr[k][j]=='.'){dotV=true; break;}
               else break;
               k--;
           }
           k=i+1;
           while(k<10){
            if(arr[k][j]=='X') downCount++;
            else if (arr[k][j]=='.'){dotV=true; break;}
            else break;
            k++;
           }
           if(itself){
               if(leftCount+rightCount>=3 && dotH) return true;
               else if(upCount+downCount>=3 && dotV) return true;
               else if(leftCount+rightCount>=4 || upCount+downCount>=4) return true;
           }else{
               if(leftCount+rightCount>=4 || upCount+downCount>=4) return true;
           }
           return false;

    }
    public static void main(String[] args) throws IOException {
        //Code starts
        FastReader ip = new FastReader();
        OutputStream output = System.out;
        PrintWriter out = new PrintWriter(output);
        char[][] arr=new char[10][10];
        for(int i=0;i<10;i++){
            String s=ip.nextLine();
            for(int j=0;j<10;j++){
                arr[i][j]=s.charAt(j);
            }
        }
        boolean ans=false;
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                if(arr[i][j]!='O' && checker(arr,i,j)){
                    ans=true;
                    break;
                }
            }
            if(ans) break;
        }

        if(ans){
            out.println("YES");
        }else{
            out.println("NO");
        }
        out.close();
        //Code ends
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;
        FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); }
        String next() { while (st == null || !st.hasMoreElements()) {
            try { st = new StringTokenizer(br.readLine()); }
            catch (IOException e) { e.printStackTrace(); } }
            return st.nextToken();
        }

        int nextInt() { return Integer.parseInt(next()); }
        long nextLong() { return Long.parseLong(next()); }
        double nextDouble() { return Double.parseDouble(next()); }

        String nextLine() {
            String str = "";
            try { str = br.readLine(); }
            catch (IOException e) { e.printStackTrace(); }
            return str;
        }
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class B {
	static FastReader scan = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		Solver solver = new Solver();
		int testCases = 1;
		while (testCases--> 0) solver.solve();
		out.close();
	}

	static class Solver {

		void solve() {
			char[][] s = new char[10][10];
			for(int i = 0; i < 10; i++) s[i] = scan.next().toCharArray();
			for(int i = 0; i < 10; i++) {
				for(int j = 0; j < 10; j++) {
					if(s[i][j] == '.') {
						char temp = s[i][j];
						s[i][j] = 'X';
						if(check(s)) {
							out.println("YES");
							return;
						}
						s[i][j] = temp;
					}
				}
			}
			out.println("NO");
		}

		static boolean check(char[][] a) {
			return v(a) || h(a) || d1(a) || d2(a);
		}

		static boolean v(char[][] a) {
			for(int i = 0; i < 6; i++) {
				for(int j = 0; j < 10; j++) {
					boolean b = true;
					for(int k = i; k < i+5; k++) {
						if(a[k][j] != 'X') {
							b = false;
							break;
						}
					}
					if(b) return true;
				}
			}
			return false;
		}
		static boolean h(char[][] a) {
			for(int i = 0; i < 10; i++) {
				for(int j = 0; j < 6; j++) {
					boolean b = true;
					for(int k = j; k < j+5; k++) {
						if(a[i][k] != 'X') {
							b = false;
							break;
						}
					}
					if(b) return true;
				}
			}
			return false;
		}
		static boolean d1(char[][] a) {
			for(int i = 0; i < 6; i++) {
				for(int j = 0; j < 6; j++) {
					boolean b = true;
					for(int k = 0; k < 5; k++) {
						if(a[i+k][j+k] != 'X') {
							b = false;
							break;
						}
					}
					if(b) return true;
				}
			}
			return false;
		}
		static boolean d2(char[][] a) {
			for(int i = 0; i < 6; i++) {
				for(int j = 9; j >= 4; j--) {
					boolean b = true;
					for(int k = 0; k < 4; k++) {
						if(a[i+k][j-k] != 'X') {
							b = false;
							break;
						}
					}
					if(b) {
						return true;
					}
				}
			}
			return false;
		}
	}

	//Sathvik's Template Stuff BELOW!!!!!!!!!!!!!!!!!!!!!!

	static class DSU {
		int[] root, size;
		int n;
		DSU(int n) {
			this.n = n;
			root = new int[n];
			size = new int[n];
			for(int i = 0; i < n; i++) {
				root[i] = i;
				size[i] = 1;
			}
		}
		int findParent(int idx) {
			while(root[idx] != idx) {
				root[idx] = root[root[idx]];
				idx = root[idx];
			}
			return idx;
		}
		boolean union(int x, int y) {
			int parX = findParent(x);
			int parY = findParent(y);
			if(parX == parY) return false;
			if(size[parX] < size[parY]) {
				root[parY] = parX;
				size[parX] += size[parY];
			} else {
				root[parX] = parY;
				size[parY] += size[parX];
			}
			return true;
		}
	}

	static class Extra {
		static void sort(int[] a) {
			Integer[] aa = new Integer[a.length];
			for (int i = 0; i < aa.length; i++) aa[i] = a[i];
			Arrays.sort(aa);
			for (int i = 0; i < aa.length; i++) a[i] = aa[i];
		}
		static void sort(long[] a) {
			Long[] aa = new Long[a.length];
			for (int i = 0; i < aa.length; i++) aa[i] = a[i];
			Arrays.sort(aa);
			for (int i = 0; i < aa.length; i++) a[i] = aa[i];
		}
		static void sort(double[] a) {
			Double[] aa = new Double[a.length];
			for (int i = 0; i < aa.length; i++) aa[i] = a[i];
			Arrays.sort(aa);
			for (int i = 0; i < aa.length; i++) a[i] = aa[i];
		}
		static void sort(char[] a) {
			Character[] aa = new Character[a.length];
			for (int i = 0; i < aa.length; i++) aa[i] = a[i];
			Arrays.sort(aa);
			for (int i = 0; i < aa.length; i++) a[i] = aa[i];
		}
		static long gcd(long a, long b) {
			while(b > 0) {
				long temp = b;
				b = a%b;
				a = temp;
			}
			return a;
		}
		static long lcm(long a, long b) {
			return a * (b / gcd(a,b));
		}
		static boolean isPrime(long n) {
			if (n <= 1) return false;
	        if (n <= 3) return true;
	        if (n % 2 == 0 || n % 3 == 0) return false;
	        for (long i = 5; i * i <= n; i = i + 6) {
	            if (n % i == 0 || n % (i + 2) == 0) return false;
	        }
	        return true;
		}
		static HashSet<Integer> sieve(int n) {
			boolean[] prime = new boolean[n+1];
			HashSet<Integer> res = new HashSet<>();
			for(int p = 2; p*p <= n; p++) {
				if(!prime[p]) {
					res.add(p);
					for(int i = p*p; i <= n; i+=p) prime[i] = true;
				}
			}
			return res;
		}
		static HashMap<Long, Integer> primeFactorization(long n) {
			HashMap<Long, Integer> res = new HashMap<>();
			while(n % 2 == 0) {
				res.put(2L, res.getOrDefault(2L, 0)+1);
				n/=2;
			}
			for(long i = 3; i*i <= n; i+=2) {
				while(n % i == 0) {
					res.put(i, res.getOrDefault(i, 0)+1);
					n/=i;
				}
			}
			if(n > 2) res.put(n, 1);
			return res;
		}
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

		int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

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

		long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

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

		double[] nextDoubleArray(int n) {
			double[] a = new double[n];
			for (int i = 0; i < n; i++)
				a[i] = nextDouble();
			return a;
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}

import java.util.*;
import java.io.*;
public class fiveinarow{
    static int[][] board;
    static String s;
    public static void main(String[] args) throws IOException{
        Scanner in = new Scanner(System.in);
        board = new int[10][10];
        for(int i = 0;i < 10; i++){
            s = in.next();
            for(int j = 0; j < 10; j++){
                if(s.charAt(j) == '.'){
                    board[i][j] = 0;
                }
                else if(s.charAt(j) == 'X'){
                    board[i][j] = -1;
                }
                else{
                    board[i][j] = 1;
                }
            }
        }
        for(int i = 0;i < 10; i++){
            for(int j = 0;j < 10; j++){
                if(works(i , j)){
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");
    }
    public static boolean works(int i , int j){
        return board[i][j] == 0 && (worksV(i , j) || worksH(i , j) || worksD(i , j));
    }
    public static boolean worksV(int i , int j){
        int k;
        int sum = 0;
        for(k = 1; k + i < 10; k++){
            if(board[k+i][j] != 1) break;
        }
        sum += k - 1;
        for(k = 1;i - k >= 0; k++){
            if(board[i-k][j] != 1) break;
        }
        return (sum + k-1) >= 4;
    }
    public static boolean worksH(int i , int j){
        int k;
        int sum = 0;
        for(k = 1; k + j < 10; k++){
            if(board[i][j+k] != 1) break;
        }
        sum += k - 1;
        for(k = 1;j - k >= 0; k++){
            if(board[i][j-k] != 1) break;
        }
        return (sum + k-1) >= 4;
    }
    public static boolean worksD(int i , int j){
        int k;
        int sum = 0;
        for(k = 1; k + j < 10 && i + k < 10; k++){
            if(board[i+k][j+k] != 1) break;
        }
        sum += k - 1;
        for(k = 1;i - k >= 0 && j - k >= 0; k++){
            if(board[i-k][j-k] != 1) break;
        }
        return (sum + k-1) >= 4;
    }

}
class FastScanner {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public FastScanner(InputStream stream) {
        this.stream = stream;
    }
    int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) return -1;
        }
        return buf[curChar++];
    }

    boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    boolean isEndline(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }

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

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

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

    public String next() {
        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 (isEndline(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndline(c));
        return res.toString();
    }
}

import java.io.* ;
import java.util.* ;
import java.util.stream.* ;
import java.text.* ;
import java.math.* ;
public class Codeshefcode{
	public static void main(String[] args) throws IOException{
		Solver Machine = new Solver() ;
		Machine.Solve() ;
		Machine.Finish();
	}
}
class Mod{
	static long mod=1000000007 ;
	static long d(long a,long b){ return (a*MI(b))%mod ; }
	static long m(long a , long b){ return (a*b)%mod ; }
	static private long MI(long a ){ return pow(a,mod-2) ; }
	static long pow(long a,long b){
		if(b<0) return pow(MI(a),-b) ;
		long val=a ; long ans=1 ;
		while(b!=0){
			if((b&1)==1) ans = (ans*val)%mod ;
			val = (val*val)%mod ;
			b>>=1 ;
		}
		return ans ;
	}
}
class pair implements Comparable<pair>{
	int x ; int y ;
	pair(int x,int y){ this.x=x ; this.y=y ;}
	public int compareTo(pair p){
		return (this.x<p.x ? -1 : (this.x>p.x ? 1 : (this.y<p.y ? -1 : (this.y>p.y ? 1 : 0)))) ;
	}
}
class Solver{
	FasterScanner ip = new FasterScanner(System.in) ;
	PrintWriter op = new PrintWriter(System.out) ;
	int mat[][] = new int[10][10] ;
	void Solve() throws IOException{
		for(int i=0 ; i<10 ; i++){
			char c[] = ip.S().toCharArray() ;
			for(int j=0 ; j<10 ; j++) mat[i][j] = (c[j]=='X' ? 1 : (c[j]=='.' ? 0 : -1)) ;
		}
		/*for(int i=0 ; i<10 ; i++){
			for(int j=0 ; j<10 ; j++) p(mat[i][j]+" ") ;
			pln("") ;
		}*/
		boolean flag=false ;
		for(int i=0 ; i<10 ; i++)
			for(int j=0 ; j<10 ; j++){
				if(mat[i][j]!=0) continue ;
				mat[i][j]=1 ;
				mylist ls[] = new mylist[4] ;
				for(int k=0 ; k<4 ; k++) ls[k] = new mylist() ;
				for(int k=0 ; k<10 ; k++) ls[0].add(mat[k][j]) ;
				for(int k=0 ; k<10 ; k++) ls[1].add(mat[i][k]) ;
				int mn = Integer.min(i,j) ;
				int x = i-mn , y = j-mn ;
				for(int k=0 ; x+k<10 && y+k<10 ; k++) ls[2].add(mat[x+k][y+k]) ;
				x=i ; y=j ;
				while(0<=x && x<=9 && 0<=y && y<=9){x-- ; y++ ;}
				for(int k=0 ; 0<=(x+k) && (x+k)<=9 && 0<=(y-k) && (y-k)<=9 ; k++) ls[3].add(mat[x+k][y-k]) ;
				for(int k=0 ; k<4 ; k++) if(checklist(ls[k])) flag=true ;
				mat[i][j]=0 ;
			}
		pln(flag ? "YES" : "NO") ;
	}
	boolean checklist(mylist lst){
		int ct=0 ;
		for(int elem : lst){
			if(elem!=1) ct=0 ;
			else{
				ct++ ;
				if(ct==5) return true ;
			}
		}
		return false ;
	}
	void p(Object o){
		op.print(o) ;
	}
	void pln(Object o){
		op.println(o) ;
	}
	void pArr(String name,Object arr,char type,int st){
		p(name+": [") ;
		if(type=='i'){
			int arr1[] = (int[]) arr ;
			for(int i=st ; i<arr1.length ; i++) p(arr1[i]+(i+1==arr1.length ? "" : ",")) ;
		}else if(type=='l'){
			long arr1[] = (long[]) arr ;
			for(int i=st ; i<arr1.length ; i++) p(arr1[i]+(i+1==arr1.length ? "" : ",")) ;
		}else if(type=='b'){
			boolean arr1[] = (boolean[]) arr ;
			for(int i=0 ; i<arr1.length ; i++) p((arr1[i] ? 1 : 0)+(i+1==arr1.length ? "" : ",")) ;
		}
		pln("]") ;
	}
	void Finish(){
		op.flush();
		op.close();
	}
}
@SuppressWarnings("serial")
class mylist extends ArrayList<Integer>{
}
@SuppressWarnings("serial")
class myset extends TreeSet<Long>{
}
@SuppressWarnings("serial")
class mystack extends Stack<Integer>{
}
@SuppressWarnings("serial")
class mymap extends TreeMap<Long,Integer>{
}
class FasterScanner {
	private InputStream mIs;
	private byte[] buf = new byte[1024];
	private int curChar,numChars;
	public FasterScanner() { this(System.in); }
	public FasterScanner(InputStream is) { mIs = is;}
	public int read() {
		if (numChars == -1) throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}
			if (numChars <= 0) return -1;
		}
		return buf[curChar++];
	}
	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 String S(){
		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 long l(){
		int c = read();
		while (isSpaceChar(c)) c = read();
		int sgn = 1;
		if (c == '-') { sgn = -1 ; c = read() ; }
		long res = 0;
		do{
			if (c < '0' || c > '9') throw new InputMismatchException();
			res *= 10 ; res += c - '0' ; c = read();
		}while(!isSpaceChar(c));
		return res * sgn;
	}
	public int i(){
		int c = read() ;
		while (isSpaceChar(c)) c = read();
		int sgn = 1;
		if (c == '-') { sgn = -1 ; c = read() ; }
		int res = 0;
		do{
			if (c < '0' || c > '9') throw new InputMismatchException();
		res *= 10 ; res += c - '0' ; c = read() ;
		}while(!isSpaceChar(c));
		return res * sgn;
	}
	public int[] ia(int n){
		int a[] = new int[n] ;
		for(int i=0 ; i<n ; i++) a[i] = i() ;
		return a ;
	}
	public long[] la(int n){
		long a[] = new long[n] ;
		for(int i=0 ; i<n ; i++) a[i] = l() ;
		return a ;
	}
	public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
	public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
}

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class FiveInARow implements Closeable {

    private InputReader in = new InputReader(System.in);
    private PrintWriter out = new PrintWriter(System.out);

    public void solve() {
        char[][] x = new char[10][10];
        for (int i = 0; i < 10; i++) {
            x[i] = in.next().toCharArray();
        }
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                if (x[i][j] == '.') {
                    x[i][j] = 'X';
                    if (ok(x)) {
                        out.println("YES");
                        return;
                    }
                    x[i][j] = '.';
                }
            }
        }
        out.println("NO");
    }

    private boolean ok(char[][] x) {
        for (int i = 0; i < 5; i++) {
            for (int j = 0; j < 5; j++) {
                if (row(x, i, j) || col(x, i, j) || diag(x, i, j)) {
                    return true;
                }
            }
        }
        return false;
    }

    private boolean row(char[][] x, int i, int j) {
        for (int k = 0; k < 5; k++) {
            if (x[i + k][j] != 'X') return false;
        }
        return true;
    }

    private boolean col(char[][] x, int i, int j) {
        for (int k = 0; k < 5; k++) {
            if (x[i][j + k] != 'X') return false;
        }
        return true;
    }

    private boolean diag(char[][] x, int i, int j) {
        for (int k = 0; k < 5; k++) {
            if (x[i + k][j + k] != 'X') return false;
        }
        return true;
    }
    @Override
    public void close() throws IOException {
        in.close();
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public 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 ni() {
            return Integer.parseInt(next());
        }

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

        public void close() throws IOException {
            reader.close();
        }
    }

    public static void main(String[] args) throws IOException {
        try (FiveInARow instance = new FiveInARow()) {
            instance.solve();
        }
    }
}

    import java.util.Scanner;

    public class FiveInARow {

        public static void main(String[] args) {
            // TODO code application logic here
            Scanner in = new Scanner(System.in);
            char m[][]= new char[10][10];
            for(int i=0;i<10;i++){
                String str=in.next();
                m[i]=str.toCharArray();
            }

            boolean ip=false;
            String output="NO";
            for(int i=0;i<10 && !ip;i++){
                for(int j=0;j<10 && !ip;j++){
                    if(m[i][j]=='X'){
                        if(j<6 && i<6 && !ip){
                            int c=0;
                            int ef=0;
                            for(int k=0;k<5;k++){
                                if(m[i+k][j+k]=='O') break;
                                else if(m[i+k][j+k]=='X') c++;
                                else if(m[i+k][j+k]=='.') ef++;
                            }
                            if(c==4 && ef==1) {ip=true;output="YES"; break;}
                        }
                        if(j<6 && !ip){
                            int c=0;
                            int ef=0;
                            for(int k=j;k<j+5;k++){
                                if(m[i][k]=='O') break;
                                else if(m[i][k]=='X') c++;
                                else if(m[i][k]=='.') ef++;
                            }
                            if(c==4 && ef==1) {ip=true;output="YES";break;}
                        }if(i<6 && !ip){
                            int c=0;
                            int ef=0;
                            for(int k=i;k<i+5;k++){
                                if(m[k][j]=='O') break;
                                else if(m[k][j]=='X') c++;
                                else if(m[k][j]=='.') ef++;
                            }
                            if(c==4 && ef==1) {ip=true;output="YES";break;}
                        }if(j>3 && i<6 && !ip){
                            int c=0;
                            int ef=0;
                            for(int k=0;k<5;k++){
                                if(m[i+k][j-k]=='O') break;
                                else if(m[i+k][j-k]=='X') c++;
                                else if(m[i+k][j-k]=='.') ef++;
                            }
                            if(c==4 && ef==1) {ip=true;output="YES";break;}

                        }
                    }
                }
            }
            System.out.println(output);
        }

    }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemB {
    BufferedReader rd;

    ProblemB() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        char[][] c = new char[10][];
        for(int i=0;i<10;i++) {
            c[i] = rd.readLine().toCharArray();
        }

        boolean ok = false;
        outer: for(int i=0;i<10;i++) {
            for (int j = 0; j < 10; j++) {
                if(c[i][j]=='.') {
                    c[i][j] = 'X';
                    if(aliceWon(c)) {
                        ok = true;
                        break outer;
                    }
                    c[i][j] = '.';
                }
            }
        }
        out(ok?"YES":"NO");
    }

    private boolean aliceWon(char[][] c) {
        int[][] ds = new int[][] {
                { 0, 1 },
                { 0, -1 },
                { 1, 1 },
                { 1, -1 },
                { -1, 0 },
                { 1, 0 },
                { -1, -1 },
                { -1, 1 }
        };
        for(int i=0;i<10;i++) {
            for(int j=0;j<10;j++) {
                int x = i;
                int y = j;
                int cnt = 0;
                for(int[] d: ds) {
                    if(x >= 0 && x < 10 && y >= 0 && y < 10) {
                        if(c[x][y] != 'X') {
                            break;
                        }
                        cnt++;
                        x += d[0];
                        y += d[1];
                    } else {
                        break;
                    }
                }
                if(cnt >= 5) {
                    return true;
                }
            }
        }
        return false;
    }

    private static void out(Object x) {
        System.out.println(x);
    }

    public static void main(String[] args) throws IOException {
        new ProblemB();
    }
}

import java.io.*;
import java.util.StringTokenizer;

public class Solution {

    public static void solve(InputReader in, PrintWriter out, DebugWriter debug) throws IOException {
        char[][] chars = new char[14][14];
        for (int i=0; i<10; i++){
            String line = in.next();
            for (int j=0; j<10; j++){
                chars[i+2][j+2] = line.charAt(j);
            }
        }

        for (int i=2; i<12; i++){
            for (int j=2; j<12; j++){
                if (chars[i][j] != '.') continue;

                if (    (chars[i-1][j] == 'X' && chars[i-2][j] == 'X' && chars[i+1][j] == 'X' && chars[i+2][j] == 'X') ||
                        (chars[i][j-1] == 'X' && chars[i][j-2] == 'X' && chars[i][j+1] == 'X' && chars[i][j+2] == 'X') ||
                        (chars[i-1][j-1] == 'X' && chars[i-2][j-2] == 'X' && chars[i+1][j+1] == 'X' && chars[i+2][j+2] == 'X') ||
                        (chars[i-1][j+1] == 'X' && chars[i-2][j+2] == 'X' && chars[i+1][j-1] == 'X' && chars[i+2][j-2] == 'X')) {
                    out.print("YES");
                    return;
                }
            }
        }

        out.print("NO");
    }

    public static void main(String[] args) throws IOException{
        InputReader in;
        PrintWriter out;
        DebugWriter debug;

        if (args.length > 0 && args[0].equals("file")) {
            in = new InputReader(new BufferedReader(new FileReader("input.txt")));
            out = new PrintWriter(new FileWriter("output.txt"));
            debug = new DebugWriter(true);

            int sampleNumber = 1;
            do {
                String nextSample = "Sample #" + sampleNumber++ + ": ";
                out.println(nextSample);
                debug.println(nextSample);

                solve(in, out, debug);

                out.println("");
                debug.println("");
            } while (in.reader.readLine() != null);
        } else {
            in = new InputReader(new BufferedReader(new InputStreamReader(System.in)));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            debug = new DebugWriter(false);

            solve(in, out, debug);
        }

        in.reader.close();
        out.close();
    }

    public static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(BufferedReader reader) {
            this.reader = reader;
            tokenizer = null;
        }

        public String next() throws IOException{
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }

            return tokenizer.nextToken();
        }

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

        public int[] nextIntArray(int n) throws IOException{
            int[] array = new int[n];
            for (int i=0; i<n; i++){
                array[i] = nextInt();
            }

            return array;
        }
    }

    public static class DebugWriter {
        public boolean enable;

        public DebugWriter(boolean enable){
            this.enable = enable;
        }

        public void print(Object o){
            if (enable) System.out.print(o);
        }

        public void println(Object o){
            if (enable) System.out.println(o);
        }
    }

}

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.regex.Matcher;

public class Main {

    public static void main(String[] args) throws Exception {
        MyReader reader = new MyReader(System.in);
        MyWriter writer = new MyWriter(System.out);
        new Main().run(reader, writer);
        writer.close();
    }

    private void run(MyReader reader, MyWriter writer) throws IOException {
        int[][] c = new int[20][20];
        for (int i = 0; i < 20; i++) {
            for (int j = 0; j < 20; j++) {
                c[i][j] = 'O';
            }
        }
        for (int i = 5; i < 15; i++) {
            for (int j = 5; j < 15; j++) {
                c[i][j] = reader.nextChar();
            }
            reader.nextChar();
        }
        for (int i = 5; i < 15; i++) {
            for (int j = 5; j < 15; j++) {
                if (c[i][j] == 'X') {
                    int a = 0;
                    int b = 0;
                    int d = 0;
                    for (int k = 0; k < 5; k++) {
                        if (c[i][j + k] == 'X') {
                            a++;
                        } else if (c[i][j + k] == 'O') {
                            a = -10;
                        }
                        if (c[i + k][j] == 'X') {
                            b++;
                        } else if (c[i + k][j] == 'O') {
                            b = -10;
                        }
                        if (c[i + k][j + k] == 'X') {
                            d++;
                        } else if (c[i + k][j + k] == 'O') {
                            d = -10;
                        }
                    }
                    if (a >= 4 || b >= 4 || d >= 4) {
                        writer.print("YES");
                        return;
                    }
                }
            }
        }
        writer.print("NO");
    }

    static class MyReader {

        final BufferedInputStream in;
        final int bufSize = 1 << 16;
        final byte buf[] = new byte[bufSize];
        int i = bufSize;
        int k = bufSize;
        final StringBuilder str = new StringBuilder();

        MyReader(InputStream in) {
            this.in = new BufferedInputStream(in, bufSize);
        }

        int nextInt() throws IOException {
            return (int) nextLong();
        }

        int[] nextIntArray(int n) throws IOException {
            int[] m = new int[n];
            for (int i = 0; i < n; i++) {
                m[i] = nextInt();
            }
            return m;
        }

        int[][] nextIntMatrix(int n, int m) throws IOException {
            int[][] a = new int[n][0];
            for (int j = 0; j < n; j++) {
                a[j] = nextIntArray(m);
            }
            return a;
        }

        long nextLong() throws IOException {
            int c;
            long x = 0;
            boolean sign = true;
            while ((c = nextChar()) <= 32) ;
            if (c == '-') {
                sign = false;
                c = nextChar();
            }
            if (c == '+') {
                c = nextChar();
            }
            while (c >= '0') {
                x = x * 10 + (c - '0');
                c = nextChar();
            }
            return sign ? x : -x;
        }

        long[] nextLongArray(int n) throws IOException {
            long[] m = new long[n];
            for (int i = 0; i < n; i++) {
                m[i] = nextLong();
            }
            return m;
        }

        int nextChar() throws IOException {
            if (i == k) {
                k = in.read(buf, 0, bufSize);
                i = 0;
            }
            return i >= k ? -1 : buf[i++];
        }

        String nextString() throws IOException {
            int c;
            str.setLength(0);
            while ((c = nextChar()) <= 32 && c != -1) ;
            if (c == -1) {
                return null;
            }
            while (c > 32) {
                str.append((char) c);
                c = nextChar();
            }
            return str.toString();
        }

        String nextLine() throws IOException {
            int c;
            str.setLength(0);
            while ((c = nextChar()) <= 32 && c != -1) ;
            if (c == -1) {
                return null;
            }
            while (c != '\n') {
                str.append((char) c);
                c = nextChar();
            }
            return str.toString();
        }

        char[] nextCharArray() throws IOException {
            return nextString().toCharArray();
        }

        char[][] nextCharMatrix(int n) throws IOException {
            char[][] a = new char[n][0];
            for (int i = 0; i < n; i++) {
                a[i] = nextCharArray();
            }
            return a;
        }
    }

    static class MyWriter {

        final BufferedOutputStream out;
        final int bufSize = 1 << 16;
        final byte buf[] = new byte[bufSize];
        int i = 0;
        final byte c[] = new byte[30];
        static final String newLine = System.getProperty("line.separator");

        MyWriter(OutputStream out) {
            this.out = new BufferedOutputStream(out, bufSize);
        }

        void print(long x) throws IOException {
            int j = 0;
            if (i + 30 >= bufSize) {
                flush();
            }
            if (x < 0) {
                buf[i++] = (byte) ('-');
                x = -x;
            }
            while (j == 0 || x != 0) {
                c[j++] = (byte) (x % 10 + '0');
                x /= 10;
            }
            while (j-- > 0)
                buf[i++] = c[j];
        }

        void print(int[] m) throws IOException {
            for (int a : m) {
                print(a);
                print(' ');
            }
        }

        void print(long[] m) throws IOException {
            for (long a : m) {
                print(a);
                print(' ');
            }
        }

        void print(String s) throws IOException {
            for (int i = 0; i < s.length(); i++) {
                print(s.charAt(i));
            }
        }

        void print(char x) throws IOException {
            if (i == bufSize) {
                flush();
            }
            buf[i++] = (byte) x;
        }

        void print(char[] m) throws IOException {
            for (char c : m) {
                print(c);
            }
        }

        void println(String s) throws IOException {
            print(s);
            println();
        }

        void println() throws IOException {
            print(newLine);
        }

        void flush() throws IOException {
            out.write(buf, 0, i);
            out.flush();
            i = 0;
        }

        void close() throws IOException {
            flush();
            out.close();
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{
	public static void main(String args[]){
		InputReader scan = new InputReader();
		char[][] c = new char[10][10];
		for(int i = 0; i < 10; i++){
			String str = scan.next();
			for(int j = 0; j < str.length(); j++)
				c[i][j] = str.charAt(j);
		}
		if(checkHorizontal(c) || checkVertical(c) || checkDiagonal1(c) || checkDiagonal2(c))
			System.out.println("YES");
		else
			System.out.println("NO");
	}

	static boolean checkHorizontal(char[][] c){
		int counter = 0, counterFromFree = 0;
		boolean free = false;
		for(int i = 0; i < 10; i++){
			for(int j = 0; j < 10; j++){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
		}
		return false;
	}

	static boolean checkVertical(char[][] c){
		int counter = 0, counterFromFree = 0;
		boolean free = false;
		for(int j = 0; j < 10; j++){
			for(int i = 0; i < 10; i++){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
		}
		return false;
	}

	static boolean checkDiagonal1(char[][] c){
		int counter = 0, counterFromFree = 0;
		boolean free = false;
		for(int k = 0; k < 10; k++){
			for(int j = 0, i = k; j < 10 && i < 10; j++, i++){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
			for(int i = 0, j = k; i < 10 && j < 10; j++, i++){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
		}
		return false;
	}

	static boolean checkDiagonal2(char[][] c){
		int counter = 0, counterFromFree = 0;
		boolean free = false;
		for(int k = 0; k < 10; k++){
			for(int j = 0, i = k; j < 10 && i >= 0; j++, i--){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
			for(int j = k, i = 0; i < 10 && j >= 0; i++, j--){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
		}
		return false;
	}

	//Custom Scanner

	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader() {
            reader = new BufferedReader(new InputStreamReader(System.in));
            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());
        }

    }

}

import java.util.Scanner;

public class MainB {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[][] array = new char[10][10];
		for(int i=0; i<10; i++) {
			String str = in.nextLine();
			for(int j=0; j<10; j++) {
				array[i][j] = str.charAt(j);
			}
		}
		for(int i=0; i<10; i++) {
			for(int j=0; j<10; j++) {
				if(array[i][j] == '.' && !isAlone(array, i, j)) {
					array[i][j] = 'X';
					for(int m=0; m<10; m++) {
						for(int n=0; n<10; n++) {
							if(array[m][n] == 'X') {
								if(m == 0 && n == 0)
								if(hasFiveInVer(array, m, n) || hasFiveInHor(array, m, n) || hasFiveInDia1(array, m, n) || hasFiveInDia2(array, m, n)) {
									System.out.println("YES");
									in.close();
									return;
								}
							}
						}
					}
					array[i][j] = '.';
				}
			}
		}
		System.out.println("NO");

		in.close();
	}

	public static boolean isAlone(char[][] array, int x, int y) {
		if(x > 0 && x < 9 && y > 0 && y < 9) {
			if(array[x-1][y-1] == 'X' || array[x-1][y] == 'X' || array[x-1][y+1] == 'X'
					|| array[x][y-1] == 'X' || array[x][y+1] == 'X'
					|| array[x+1][y-1] == 'X' || array[x+1][y] == 'X' || array[x+1][y+1] == 'X') {
				return false;
			}
		}else if(x == 0 && y > 0 && y < 9) {
			if(array[x][y-1] == 'X' || array[x][y+1] == 'X' || array[x+1][y-1] == 'X' || array[x+1][y] == 'X' || array[x+1][y+1] == 'X') {
				return false;
			}
		}else if(x == 9 && y > 0 && y < 9) {
			if(array[x][y-1] == 'X' || array[x][y+1] == 'X' || array[x-1][y-1] == 'X' || array[x-1][y] == 'X' || array[x-1][y+1] == 'X') {
				return false;
			}
		}else if(y == 0 && x > 0 && x < 9) {
			if(array[x-1][y] == 'X' || array[x+1][y] == 'X' || array[x+1][y+1] == 'X' || array[x][y+1] == 'X' || array[x-1][y+1] == 'X') {
				return false;
			}
		}else if(y == 9 && x > 0 && x < 9) {
			if(array[x-1][y] == 'X' || array[x+1][y] == 'X' || array[x+1][y-1] == 'X' || array[x][y-1] == 'X' || array[x-1][y-1] == 'X') {
				return false;
			}
		}
		return true;
	}

	public static boolean hasFiveInHor(char[][] array, int x, int y) {
		if(y > 5)
			return false;
		for(int j = y; j < y+5; j++) {
			if(array[x][j] != 'X')
				return false;
		}
		return true;
	}

	public static boolean hasFiveInVer(char[][] array, int x, int y) {
		if(x > 5)
			return false;
		for(int i = x; i < x+5; i++) {
			if(array[i][y] != 'X')
				return false;
		}
		return true;
	}

	public static boolean hasFiveInDia1(char[][] array, int x, int y) {
		if(x > 5 || y > 5)
			return false;
		for(int i=0; i<5; i++) {
			if(array[x+i][y+i] != 'X')
				return false;
		}
		return true;
	}

	public static boolean hasFiveInDia2(char[][] array, int x, int y) {
		if(x > 5 || y < 4)
			return false;
		for(int i=0; i<5; i++) {
			if(array[x+i][y-i] != 'X')
				return false;
		}
		return true;
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;

public class Competitive_1 {

	static char arr[][];

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		arr = new char[10][];
		for(int i=0; i<10; i++)
			arr[i] = in.next().toCharArray();

		boolean ans = false;
		for(int i=0; i<10; i++){
			for(int j=0; j<10; j++){
				if(arr[i][j]=='X')
					ans = canWin(i, j, 5, true, 0, 1) || canWin(i, j, 5, true, 1, 1) || canWin(i, j, 5, true, 1, -1) || canWin(i, j, 5, true, 1, 0);
				if(ans){
					System.out.println("YES");
					return;
				}
			}
		}

		System.out.println("NO");
	}

	public static boolean canWin(int i, int j, int need, boolean canBlank, int dirX, int dirY){
		if(need == 0)
			return true;
		if(i<0 || i>=10 || j<0 || j>=10 || arr[i][j]=='O' || (canBlank==false && arr[i][j]=='.'))
			return false;

		if(arr[i][j]=='.')
			canBlank = false;

		return canWin(i+dirX, j+dirY, need-1, canBlank, dirX, dirY);
	}

	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

}

/*
LANG: JAVA
TASK:
*/

import java.io.*;
import java.util.*;
public class cf
{
	public static void main(String[] args) throws IOException
	{
		Scanner c = new Scanner(System.in);
		String str = c.next();
		int[][] grid = new int[str.length()][str.length()];

		for(int j=0; j<str.length(); j++) grid[0][j] = str.charAt(j)=='X'?1:(str.charAt(j)=='.'?0:-1);

		for(int i=0; i<str.length()-1; i++)
		{
			str = c.next();
			for(int j=0; j<str.length(); j++) grid[i+1][j] = str.charAt(j)=='X'?1:(str.charAt(j)=='.'?0:-1);
		}

		boolean yes=false;
		int move[][] = {{0,1},{0,-1},{1,0},{-1,0},{1,1},{1,-1},{-1,-1},{-1,1}};
		for(int i=0; i<str.length(); i++)
		{
			for(int j=0; j<str.length(); j++)
			{
				int x=i, y=j;
				for(int k=0; k<move.length; k++)
				{
					int count = 0;

					for(int l=0; l<5; l++)
					{
						x+=move[k][0]; y+=move[k][1];
						count += (x<10&&y<10&&x>=0&&y>=0)?grid[x][y]:-1;
					}
					if(count==4)
					{
						yes=true;
						System.out.println(i+" "+j+" "+k);
					}
				}
			}
		}

		System.out.println(yes?"YES":"NO");
	}
}

/*
LANG: JAVA
TASK:
*/

import java.io.*;
import java.util.*;
public class cf
{
	public static void main(String[] args) throws IOException
	{
		Scanner c = new Scanner(System.in);
		String str = c.next();
		int[][] grid = new int[str.length()][str.length()];

		for(int j=0; j<str.length(); j++) grid[0][j] = str.charAt(j)=='X'?1:-1;

		for(int i=0; i<str.length()-1; i++)
		{
			str = c.next();
			for(int j=0; j<str.length(); j++) grid[i+1][j] = str.charAt(j)=='X'?1:-1;
		}

		boolean yes=false;
		int move[][] = {{0,1},{0,-1},{1,0},{-1,0},{1,1},{1,-1},{-1,-1},{-1,1}};
		for(int i=0; i<str.length(); i++)
		{
			for(int j=0; j<str.length(); j++)
			{
				int x=i, y=j;
				int count = 0;

				for(int k=0; k<move.length; k++)
				{
					for(int l=0; l<5; l++)
					{
						x+=move[k][0]; y+=move[k][1];
						count += (x<10&&y<10&&x>=0&&y>=0)?grid[x][y]:-1;
					}
					if(count==4) yes=true;
				}
			}
		}

		System.out.println(yes?"YES":"NO");
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class D{

	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

	static class Pair
	{
		int p;
		int q;
		Pair(int p,int q)
		{
			this.p = p;
			this.q = q;
		}
	}

	public static void main(String[] args)
	{
		OutputStream outputStream = System.out;
        FastReader sc = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);

        char mat[][] = new char[10][10];

        for(int i = 0; i < 10; i++)
        {

        	mat[i] = sc.nextLine().toCharArray();

        }

        for(int i = 0; i < 10; i++)
        {
        	for(int j = 0; j < 10; j++)
        	{

        		if(mat[i][j] == 'X')
        		{
        			//right
        			//System.out.println("in");
        			boolean done = false;
        			for(int k = 1; k < 5 && k+j < 10; k++)
        			{
        				//out.println("down");
        				if(mat[i][j+k] == 'O') break;
        				if(mat[i][j+k] == '.' && done == false)
        				{
        					done = true;
        				}
        				else if(mat[i][j+k] == '.' && done == true)
        				{
        					break;
        				}
        				if(k == 4)
        				{
        					out.println("YES");
        					out.close();
        					return;
        				}

        			}

        			//down
        			done = false;
        			for(int k = 1; k < 5 && k+i < 10; k++)
        			{
        				//out.println("right");
        				if(mat[i+k][j] == 'O') break;
        				if(mat[i+k][j] == '.' && done == false)
        				{
        					done = true;
        				}
        				else if(mat[i+k][j] == '.' && done == true)
        				{
        					break;
        				}
        				if(k == 4)
        					{
        					out.println("YES");
        					out.close();
        					return;
        					}
        			}

        			//diag left
        			for(int k = 1; k < 5 && j-k >=0 && k+i < 10; k++)
        			{
        				//out.println("in diag left");
        				if(mat[i+k][j-k] == 'O') break;
        				if(mat[i+k][j-k] == '.' && done == false)
        					{
        					done = true;
        					}
        				else if(mat[i+k][j-k] == '.' && done == true) break;
        				if(k == 4)
        				{
        					out.println("YES");
        					out.close();
        					return;
        				}

        			}
        			//diag right
        			for(int k = 1; k < 5 && i+k < 10 && j+k < 10; k++)
        			{
        				//out.println("in diag right");
        				if(mat[i+k][j+k] == 'O') break;
        				if(mat[i+k][j+k] == '.' && done == false)
        				{
        					done = true;
        				}
        				if(mat[i+k][j+k] == '.' && done == true) break;
        				if(k == 4)
        				{
        					out.println("YES");
        					out.close();
        					return;
        				}

        			}
        		}
        	}
        }
        out.println("NO");

        out.close();
	}

}

import java.util.*;
/**
 *
 * @author sid
 */
public class Main {

    /**
     * @param args the command line arguments
     */

    public static void main(String[] args) {
        // TODO code application logic here
    String[] field = new String[10];
        Scanner s = new Scanner(System.in);
        for(int i =0;i<10;i++){
            field[i] =  s.next();
        }
        String test=new String();
        int flag = 0;
        for(int i =0;i<10;i++){
            test=field[i];
            if(test.contains("XX.XX") ||test.contains("X.XXX") || test.contains("XXX.X") || test.contains(".XXXX") || test.contains("XXXX.")){
                flag = 1;
                break;
            }
        }
        if(flag == 0){
            test = "";
            for(int i = 0;i<10;i++){
                String c;
                c =   Character.toString(field[i].charAt(i));
                test = test+c;
            }
            if(test.contains("XX.XX") ||test.contains("X.XXX") || test.contains("XXX.X") || test.contains(".XXXX") || test.contains("XXXX.")){
                flag = 1;

            }
            if(flag == 0){

            for(int i = 0;i<10;i++){
            test = "";
            for(int j= 0;j<10;j++){
                String c;
                c =   Character.toString(field[j].charAt(i));
                test = test+c;
            }
             if(test.contains("XX.XX") ||test.contains("X.XXX") || test.contains("XXX.X") || test.contains(".XXXX") || test.contains("XXXX.")){
                flag = 1;
              break;
            }
             if(flag ==1){
                 break;
             }
                }
            if(flag ==1){
                System.out.println("YES");
            }
            else{
                System.out.println("NO");
            }
            }
            else{
                System.out.println("YES");
            }

        }

        else{
            System.out.println("YES");
        }

    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.Scanner;

public class main {

	public static void main(String[] args) throws NumberFormatException, IOException{
Scanner sc=new Scanner(System.in);
String arr[]=new String[10];
for(int i=0;i<10;i++){
	arr[i]=sc.nextLine();
}

for(int i=0;i<10;i++){
int arr1[]=new int[11];
	for(int j=0;j<10;j++){
if(arr[i].charAt(j)=='.'){
	int left=0;
	int right=0;
	int up=0;
	int down=0;
	int dl=0;
	int ur=0;
	int ul=0;
	int dr=0;
	for(int k=j-1;k>=0;k--){
		if(arr[i].charAt(k)=='X') left++;
		else break;
	}
	for(int k=j+1;k<10;k++){
		if(arr[i].charAt(k)=='X') right++;
		else break;
	}
	for(int k=i-1;k>=0;k--){
		if(arr[k].charAt(j)=='X') up++;
		else break;
	}
	for(int k=i+1;k<10;k++){
		if(arr[k].charAt(j)=='X') down++;
		else break;
	}
	for(int k=j-1, l=i-1;l>=0&&k>=0;l--,k--){
		if(arr[k].charAt(l)=='X') ul++;
	}
	for(int k=j+1, l=i+1;l<10&&k<10;l++,k++){
		if(arr[k].charAt(l)=='X') dr++;
	}
	for(int k=j+1, l=i-1;l>=0&&k<10;l--,k++){
		if(arr[k].charAt(l)=='X') ur++;
	}
	for(int k=j-1, l=i+1;l<10&&k>=10;l++,k--){
		if(arr[k].charAt(l)=='X') dl++;
	}
	int yes=0;
	if(left+right>=4) yes=1;
	if(up+down>=4) yes=1;
	if(ul+dr>=4) yes=1;
	if(dl+ur>=4) yes=1;
	if(yes==1){ System.out.println("YES"); return;}

}
}
}
System.out.println("NO");

	}}

import java.util.Scanner;

/**
 *
 * 作者：张宇翔
 * 创建日期：2017年7月16日 下午11:04:25
 * 描述：
 */
public class Main {

	private static final int Max = (int) (1e3 + 10);
	private static String []s;
	private static char [][]a;
	public static void main(String[] args) {
		InitData();
		GetAns();
	}
	private static void InitData() {
		Scanner cin = new Scanner(System.in);
		s=new String[Max];
		a=new char[Max][Max];
		for(int i=0;i<10;i++){
			s[i]=cin.next();
			a[i]=s[i].toCharArray();
		}
	};

	private static void GetAns() {
		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				if(a[i][j]=='.'){
					a[i][j]='X';
					if(judge()){
						System.out.println("YES");
						return;
					}
					a[i][j]='.';
				}
			}
		}
		System.out.println("NO");
		return;
	};

	private static boolean judge(){
		for(int i=0;i<10;i++){//判断横
			for(int j=0;j<=10-5;j++){
				if(a[i][j]=='X'&&a[i][j+1]=='X'&&a[i][j+2]=='X'
						&&a[i][j+3]=='X'&&a[i][j+4]=='X'){
					return true;
				}
			}
		}
		for(int i=0;i<10;i++){//判断竖
			for(int j=0;j<=10-5;j++){
				if(a[j][i]=='X'&&a[j+1][i]=='X'&&a[j+2][i]=='X'
						&&a[j+3][i]=='X'&&a[j+4][i]=='X'){
					return true;
				}
			}
		}

		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				int cnt=0;
				if(Check(i, j)){
					cnt++;
				}
				if(Check(i+1, j+1)){
					cnt++;
				}
				if(Check(i+2, j+2)){
					cnt++;
				}
				if(Check(i+3, j+3)){
					cnt++;
				}
				if(Check(i+4, j+4)){
					cnt++;
				}
				if(cnt==5){
					return true;
				}
			}
		}

		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				int cnt=0;
				if(Check(i, j)){
					cnt++;
				}
				if(Check(i-1, j-1)){
					cnt++;
				}
				if(Check(i-2, j-2)){
					cnt++;
				}
				if(Check(i-3, j-3)){
					cnt++;
				}
				if(Check(i-4, j-4)){
					cnt++;
				}
				if(cnt==5){
					return true;
				}
			}
		}
		return false;
	}

	private static boolean Check(int x,int y){
		if(x>=0&&x<10&&y>=0&&y<10&&a[x][y]=='X'){
			return true;
		}
		return false;
	}

}

import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author tirex
 */
public class Solution2 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String f[][] = new String[10][10];
        for (int i = 0; i < 10; i++) {
            String st = in.next();
            for (int j = 0; j < 10; j++) {
                f[i][j] = st.substring(j, j + 1);
            }
        }

        int xcount = 0;
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                if (!f[i][j].equals(".")) {
                    break;
                }
                int locali = i;
                int localj = j;
                //vert
                while (locali >= 0 && f[locali][localj].equals("X") && !f[locali][localj].equals("0") && !f[locali][localj].equals(".")) {
                    locali--;
                    xcount++;
                }
                locali = i;
                localj = j;
                while (locali < 10 && f[locali][localj].equals("X") && !f[locali][localj].equals("0") && !f[locali][localj].equals(".")) {
                    locali++;
                    xcount++;
                }
                if (xcount > 3) {
                    System.out.println("YES");
                    return;
                }
                locali = i;
                localj = j;
                while (localj >= 0 && f[locali][localj].equals("X") && !f[locali][localj].equals("0") && !f[locali][localj].equals(".")) {
                    localj--;
                    xcount++;
                }
                locali = i;
                localj = j;
                while (localj < 10 && f[locali][localj].equals("X") && !f[locali][localj].equals("0") && !f[locali][localj].equals(".")) {
                    localj++;
                    xcount++;
                }
                if (xcount > 3) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");
    }

}

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {

        File file = new File("in.txt");
        File fileOut = new File("out.txt");
        InputStream inputStream = null;
        OutputStream outputStream = null;
        // try {inputStream= new FileInputStream(file);} catch (FileNotFoundException ex){return;};
//        try {outputStream= new FileOutputStream(fileOut);} catch (FileNotFoundException ex){return;};
        inputStream = System.in;
        outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

}

class TaskB {
    private List<String> matrix;
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        matrix = new ArrayList<>();
        for(int i=0; i<10; i++){
            matrix.add(in.next());
        }
        for(int i=0; i<10; i++){
            if(canWin(matrix.get(i))){
                out.println("YES");
                return;
            }
        }
        for(int i=0; i<10; i++){
            StringBuilder sb = new StringBuilder();
            for(int j=0; j<10; j++){
                sb.append(matrix.get(j).charAt(i));
            }
            if(canWin(sb.toString())){
                out.println("YES");
                return;
            }
        }

        for(int i=0; i<10; i++){
            if(canWin(mainDiagonal(0,i))){
                out.println("YES");
                return;
            }
        }
        for(int j=1; j<10; j++){
            if(canWin(mainDiagonal(0,j))){
                out.println("YES");
                return;
            }
        }

        for(int i=0; i<10; i++){
            String s = minorDiagonal(i,0);
            if(canWin(s)){
                out.println("YES");
                return;
            }
        }

        for(int j=1; j<10; j++){
            String s = minorDiagonal(9,j);
            if(canWin(s)){
                out.println("YES");
                return;
            }
        }
        out.println("NO");

    }

    public String mainDiagonal(Integer minY, Integer minX){
        StringBuilder sb = new StringBuilder();
        while(minY<10 & minX < 10){
            sb.append(matrix.get(minY).charAt(minX));
            minY++;
            minX++;
        }
        return sb.toString();
    }

    public String minorDiagonal(Integer maxY, Integer minX){
        StringBuilder sb =  new StringBuilder();
        while(maxY>=0 && minX<10){
            sb.append(matrix.get(maxY).charAt(minX));
            maxY--;
            minX++;
        }
        return sb.toString();
    }

    public Boolean canWin(String seq){
        Integer crossedNeeded = 0;
        Integer validSeq = 0;
        Integer maxValid = Integer.MIN_VALUE;
        Integer lastCross = null;
        for(int i=0; i<seq.length(); i++){
            if(seq.charAt(i)=='X'){
                validSeq++;
                maxValid = Math.max(maxValid, validSeq);
            }
            else if(seq.charAt(i) == 'O'){
                validSeq=0;
                crossedNeeded=0;
            }
            else {
                if(crossedNeeded==0){
                    crossedNeeded++;
                    lastCross = i;
                    validSeq++;
                    maxValid = Math.max(maxValid, validSeq);
                }
                else{
                    validSeq = (i-lastCross);
                    lastCross = i;
                }
            }
        }
        if(maxValid>=5){
            return Boolean.TRUE;
        }
        return Boolean.FALSE;

    }

}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public 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 String nextLine(){
        try {
            return reader.readLine();
        } catch (IOException e){
            throw new RuntimeException(e);
        }
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }
    public long nextLong() { return Long.parseLong(next()); }

}

class Pair<F, S> {
    public final F first;
    public final S second;

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

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof Pair)) {
            return false;
        }
        Pair<?, ?> p = (Pair<?, ?>) o;
        return Objects.equals(p.first, first) && Objects.equals(p.second, second);
    }

    @Override
    public int hashCode() {
        return (first == null ? 0 : first.hashCode()) ^ (second == null ? 0 : second.hashCode());
    }

    @Override
    public String toString() {
        return "(" + first + ", " + second + ')';
    }
}

import java.util.Scanner;

public class FiveInRow {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int index = -1;
        String[] matrix = new String[10];
        for (int i = 0; i < 10; i++){
            matrix[i] = sc.nextLine();
            if (index == -1 && matrix[i].contains("X")){
                index = i;
            }
        }
        if (index == -1){
            System.out.println("NO");
        } else {
            if (horizontalCheck(matrix[index]) || verticalCheck(matrix,index) || diagonalCheck(matrix,index)){
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
    public static boolean horizontalCheck(String line){
        if (line.contains(".XXXX") || line.contains("XXXX.") ||
                line.contains("X.XXX") || line.contains("XX.XX") ||
                line.contains("XXX.X")){
            return true;
        }
        return false;
    }
    public static boolean verticalCheck(String[] field, int index) {
        String line = "";
        for (int i = 0; i < 10; i++) {
            line += field[i].charAt(index);
        }
        return horizontalCheck(line);
    }
    public static boolean diagonalCheck(String[] field, int index){
        String line = "";
        int x = field[index].indexOf("X")-1;
        int i = index;
        for (int t = 0; t < index-1; t ++){
            line+=".";
        }
        while (++x<10){
            line+= field[i].charAt(x);
            i++;
        }
        System.out.println(line);
        if (!horizontalCheck(line)){
            line = "";
            for (int t = 0; t < index-1; t ++){
                line+=".";
            }
            i = index;
            x = field[index].indexOf("X")+1;
            while (--x>=0){
                line+= field[i].charAt(x);
                i++;
            }
            return horizontalCheck(line);
        } else {
            return horizontalCheck(line);
        }
    }
}

import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;

@SuppressWarnings("unchecked")
public class P825B {

  char [][] f = new char [10][];

  boolean checkX(int x, int y) {
    return (((x < 10) && (y < 10)) ? (f[y][x] == 'X') : false);
  }

  boolean check() {
    for (int y = 0; y < 10; y++) {
      for (int x = 0; x < 10; x++) {
        boolean rx = true, cx = true, dx = true;

        for (int d = 0; d < 5; d++) {
          rx &= checkX(x + d,     y);
          cx &= checkX(    x, y + d);
          dx &= checkX(x + d, y + d);
        }

        if (rx | cx | dx) {
          return true;
        }
      }
    }

    return false;
  }

  public void run() throws Exception {
    for (int i = 0; i < 10; f[i] = next().toCharArray(), i++);

    for (int y = 0; y < 10; y++) {
      for (int x = 0; x < 10; x++) {
        if (f[y][x] == '.') {
          f[y][x] = 'X';

          if (check()) {
            println("YES");
            return;
          }

          f[y][x] = '.';
        }
      }
    }

    println("NO");
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P825B().run();
    br.close();
    pw.close();
    System.err.println("\n[Time : " + (System.currentTimeMillis() - startTime) + " ms]");
  }

  static long startTime = System.currentTimeMillis();
  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

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

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { print("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }

  int gcd(int a, int b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Integer.numberOfTrailingZeros(a), bz = Integer.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Integer.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Integer.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }

  long gcd(long a, long b) {
    if (a == 0) return Math.abs(b); if (b == 0) return Math.abs(a);
    a = Math.abs(a); b = Math.abs(b);
    int az = Long.numberOfTrailingZeros(a), bz = Long.numberOfTrailingZeros(b);
    a >>>= az; b >>>= bz;
    while (a != b) {
      if (a > b) { a -= b; a >>>= Long.numberOfTrailingZeros(a); }
            else { b -= a; b >>>= Long.numberOfTrailingZeros(b); }
    }
    return (a << Math.min(az, bz));
  }
}

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;

public class B {

  private static final String REGEX = " ";
  private static final Boolean DEBUG = false;
  private static final String FILE_NAME = "input.txt";

  public static void main(String[] args) throws IOException {
    if (DEBUG) {
      generate();
    }
    Solver solver = new Solver();
    solver.readData();
    solver.solveAndPrint();
  }

  private static void generate() throws IOException {
//    FileWriter writer = new FileWriter("input.txt");
//    writer.close();
  }

  private static class Solver {

    String[] field = new String[10];
    int curI, curJ;

    void readData() throws IOException {
      InputStream in = DEBUG ? new FileInputStream(FILE_NAME) : System.in;
      Scanner scanner = new Scanner(in);
      for (int i = 0; i < 10; i++) {
        field[i] = scanner.nextLine();
      }
      scanner.close();
    }

    void solveAndPrint() {
      char c;
      for (int i = 0; i < 10; i++) {
        String row = field[i];
        for (int j = 0; j < 10; j++) {
          c = row.charAt(j);
          if (c == '.') {
            curI = i;
            curJ = j;
            if (check(i, j)) {
              System.out.println("YES");
              return;
            }
          }
        }
      }
      System.out.println("NO");
    }

    private boolean check(int i, int j) {
      if (checkHor(i, j - 4) || checkHor(i, j - 3) || checkHor(i, j - 2) || checkHor(i, j - 1) || checkHor(i, j)) {
        return true;
      }
      if (checkVer(i - 4, j) || checkVer(i - 3, j) || checkVer(i - 2, j) || checkVer(i - 1, j) || checkVer(i, j)) {
        return true;
      }
      if (checkDia(i - 4, j - 4) || checkDia(i - 3, j - 3) || checkDia(i - 2, j - 2) || checkDia(i - 1, j - 1) || checkDia(i, j)) {
        return true;
      }
      return false;
    }

    private boolean checkHor(int i, int j) {
      int j1 = j;
      int i1 = i;
      for (int k = 0; k < 4; k++) {
        j1 = j + k;
        if (i1 < 0 || i1 >= 10 || j1 < 0 || j1 >= 10) {
          return false;
        }
        if (i1 == curI && j1 == curJ) {
          continue;
        }
        if (field[i1].charAt(j1) != 'X') {
          return false;
        }
      }
      return true;
    }

    private boolean checkVer(int i, int j) {
      int j1 = j;
      int i1 = i;
      for (int k = 0; k < 4; k++) {
        i1 = i + k;
        if (i1 < 0 || i1 >= 10 || j1 < 0 || j1 >= 10) {
          return false;
        }
        if (i1 == curI && j1 == curJ) {
          continue;
        }
        if (field[i1].charAt(j1) != 'X') {
          return false;
        }
      }
      return true;

    }

    private boolean checkDia(int i, int j) {
      int j1 = j;
      int i1 = i;
      for (int k = 0; k < 4; k++) {
        i1 = i + k;
        j1 = j + k;
        if (i1 < 0 || i1 >= 10 || j1 < 0 || j1 >= 10) {
          return false;
        }
        if (i1 == curI && j1 == curJ) {
          continue;
        }
        if (field[i1].charAt(j1) != 'X') {
          return false;
        }
      }
      return true;
    }

    @SuppressWarnings("SameParameterValue")
    int[] splitInteger(String string, int n) {
      final String[] split = string.split(REGEX, n);
      int[] result = new int[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Integer.parseInt(split[i]);
      }
      return result;
    }

    public int[] splitInteger(String string) {
      return splitInteger(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    long[] splitLong(String string, int n) {
      final String[] split = string.split(REGEX, n);
      long[] result = new long[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Long.parseLong(split[i]);
      }
      return result;
    }

    public long[] splitLong(String string) {
      return splitLong(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    double[] splitDouble(String string, int n) {
      final String[] split = string.split(REGEX, n);
      double[] result = new double[split.length];
      for (int i = 0; i < n; ++i) {
        result[i] = Double.parseDouble(split[i]);
      }
      return result;
    }

    public double[] splitDouble(String string) {
      return splitDouble(string, 0);
    }

    @SuppressWarnings("SameParameterValue")
    String[] splitString(String string, int n) {
      return string.split(REGEX, n);
    }

    public String[] splitString(String string) {
      return splitString(string, 0);
    }

    public int max(int a, int b) {
      return Math.max(a, b);
    }

    public long max(long a, long b) {
      return Math.max(a, b);
    }

    public int min(int a, int b) {
      return Math.min(a, b);
    }

    public long min(long a, long b) {
      return Math.min(a, b);
    }

    public double max(double a, double b) {
      return Math.max(a, b);
    }

    public double min(double a, double b) {
      return Math.min(a, b);
    }

    private final static int MOD = 1000000009;

    int multMod(int a, int b) {
      return ((a % MOD) * (b % MOD)) % MOD;
    }

    int sumMod(int a, int b) {
      return ((a % MOD) + (b % MOD)) % MOD;
    }

    long multMod(long a, long b) {
      return ((a % MOD) * (b % MOD)) % MOD;
    }

    long sumMod(long a, long b) {
      return ((a % MOD) + (b % MOD)) % MOD;
    }
  }

}

import java.util.Scanner;

public class Fiveinrow {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		boolean isRowGood=false;
		boolean isCoGood=false;
		boolean isDiaGood=false;
		boolean isReDiaGood=false;
		int[][]a=new int[10][10];
		int[][]b=new int[10][10];
		Scanner in = new Scanner(System.in);
		for(int i=0;i<10;i++) {
			String s=in.next();
			for(int j=0;j<10;j++) {
				if(s.charAt(j)=='O')
					a[i][j]=-1;
				else if(s.charAt(j)=='X')
					a[i][j]=1;
				else
					a[i][j]=0;
				b[9-i][9-j]=a[i][j];
			}
		}
		here:for(int i=0;i<10;i++) {
				for(int j=0;j<6;j++) {
					if(a[i][j]+a[i][j+1]+a[i][j+2]+a[i][j+3]+a[i][j+4]>=4) {
						isRowGood=true;
						break here;
					}
					if(a[j][i]+a[j+1][i]+a[j+2][i]+a[j+3][i]+a[j+4][i]>=4) {
						isCoGood=true;
						break here;
					}
				}
			}
		there:for(int i=0;i<6;i++) {
				for(int j=0;j<6;j++) {
					if(a[i][j]+a[i+1][j+1]+a[i+2][j+2]+a[i+3][j+3]+a[i+4][j+4]>3) {
						isDiaGood=true;
						break there;
					}
					if(b[i][j]+b[i+1][j+1]+b[i+2][j+2]+b[i+3][j+3]+b[i+4][j+4]>3) {
						isReDiaGood=true;
						break there;
					}
				}
		}
		if(isRowGood||isCoGood ||isDiaGood ||isReDiaGood  )
			System.out.print("YES");
		else
			System.out.print("NO");
	}
}

import java.util.Scanner;

public class b825 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn = new Scanner(System.in);
		char[][] arr = new char[10][10];
		for (int i = 0; i < 10; i++) {
			String s=scn.next();
			for (int j = 0; j < 10; j++) {
				arr[i][j] = s.charAt(j);
			}
		}

		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				if(check(i, j, arr))
				{
					return;
				}
			}
		}

		System.out.println("NO");

	}

	public static boolean check(int row, int col, char[][] arr) {
		int xcount = 0;
		int dotcount = 0;

		for (int i = row; i < row + 5 && i < 10; i++) {

			if (arr[i][col] == 'X') {
				xcount++;
			} else if (arr[i][col] == '.') {
				dotcount++;
			}

		}
		if (xcount == 4 && dotcount == 1) {
			System.out.println("YES");
			return true;
		}

		xcount = 0;
		dotcount = 0;
		for (int i = col; i < col + 5 && i < 10; i++) {

			if (arr[i][col] == 'X') {
				xcount++;
			} else if (arr[i][col] == '.') {
				dotcount++;
			}

		}
		if (xcount == 4 && dotcount == 1) {
			System.out.println("YES");
			return true;
		}
		xcount = 0;
		dotcount = 0;

		for (int i = row, j = col; i < row + 5 && j < col + 5 && i < 10 && j < 10; i++, j++) {

			if (arr[i][j] == 'X') {
				xcount++;
			} else if (arr[i][j] == '.') {
				dotcount++;
			}

		}
		if (xcount == 4 && dotcount == 1) {
			System.out.println("YES");
			return true;
		}
		return false;

	}

}

import java.util.*;

public class CODE {

    static Scanner sc = new Scanner(System.in);
    static char arr[][] = new char[10][10];

    static boolean isHozRight(int x, int y) {
        int c = 0;
        int dots=0;
        for (int i = y; i < y + 5; i++) {
            try{if(arr[x][i]=='X')c++;if(arr[x][i]=='.')dots++;}catch(Exception ex){return false;}
        }

        if(dots>0)dots=1;

        return c+dots==5;
    }

    static boolean isHozLeft(int x, int y) {
        int c = 0;
        int dots = 0;

        for (int i = y; i > y - 5; i--) {
            try{if(arr[x][i]=='X')c++;if(arr[x][i]=='.')dots++;}catch(Exception ex){return false;}
        }
        if(dots>0)dots=1;

        return c+dots==5;
    }

    static boolean isVerUp(int x, int y){
        int c = 0;
        int dots = 0;

        for (int i = x; i < x + 5; i++) {
            try{if(arr[i][y]=='X')c++;if(arr[i][y]=='.')dots++;}catch(Exception ex){return false;}
        }

        if(dots>0)dots=1;

        return c+dots==5;
    }

    static boolean isVerDown(int x, int y) {
        int c = 0;
        int dots = 0;

        for (int i = x; i > x - 5; i--) {
            try{if(arr[i][y]=='X')c++;if(arr[i][y]=='.')dots++;}catch(Exception ex){return false;}
        }

        if(dots>0)dots=1;

        return c+dots==5;
    }

    static boolean isDia1(int x, int y) {
        int c = 0;
        int dots = 0;

        for (int i = x; i < x + 5; i++) {
            try{if(arr[x-i][y-i]=='X')c++;if(arr[x-i][y-i]=='.')dots++;}catch(Exception ex){return false;}
        }

        if(dots>0)dots=1;

        return c+dots==5;
    }

    static boolean isDia2(int x, int y) {
        int c = 0;
        int dots = 0;

        for (int i = x; i < x + 5; i++) {
            try{if(arr[x+i][y+i]=='X')c++;if(arr[x+i][y+i]=='.')dots++;}catch(Exception ex){return false;}
        }
        if(dots>0)dots=1;

        return c+dots==5;
    }

    static boolean isDia3(int x, int y) {
        int c = 0;
        int dots = 0;

        for (int i = x; i < x + 5; i++) {
            try{if(arr[x+i][y-i]=='X')c++;if(arr[x+i][y-i]=='.')dots++;}catch(Exception ex){return false;}
        }
        if(dots>0)dots=1;

        return c+dots==5;
    }

    static boolean isDia4(int x, int y) {
        int c = 0;
        int dots = 0;

        for (int i = x; i < x + 5; i++) {
            try{if(arr[x-i][y+i]=='X')c++;if(arr[x-i][y+i]=='.')dots++;}catch(Exception ex){return false;}
        }
            if(dots>0)dots=1;

        return c+dots==5;
    }

    static boolean is(int x, int y) {
        return isHozRight(x, y) || isHozRight(x, y) || isVerUp(x, y) || isVerDown(x, y) || isDia1(x, y) || isDia2(x, y)|| isDia3(x, y)|| isDia4(x, y);
    }

    public static void main(String[] args) {
        for (int x = 0; x < 10; x++) {
                String s = sc.next();
                arr[x]=s.toCharArray();
        }

        for (int x = 0; x < 10; x++) {
            for (int y = 0; y < 10; y++) {
                if(is(x, y)){
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");

    }
}

/**
 * @author Finn Lidbetter
 */
import java.util.*;
import java.io.*;
import java.awt.geom.*;

public class TaskB {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();
    int n = 10;
    char[][] board = new char[n][n];
    for (int i=0; i<n; i++) {
      board[i] = br.readLine().toCharArray();
    }
    boolean poss = false;
    for (int i=0; i<n; i++) {
      for (int j=0; j<n-5; j++) {
        int nO = 0;
        int nX = 0;
        int nD = 0;
        for (int k=0; k<5; k++) {
          if (board[i][j+k]=='O') {
            nO++;
          } else if (board[i][j+k]=='X')
            nX++;
          else
            nD++;

        }
        if (nX==4 && nD==1)
          poss = true;
      }
    }
    for (int i=0; i<n-5; i++) {
      for (int j=0; j<n; j++) {
        int nO = 0;
        int nX = 0;
        int nD = 0;
        for (int k=0; k<5; k++) {
          if (board[i+k][j]=='O') {
            nO++;
          } else if (board[i+k][j]=='X')
            nX++;
          else
            nD++;
        }
        if (nX==4 && nD==1)
          poss = true;
      }
    }
    for (int i=0; i<n-5; i++) {
      for (int j=0; j<n-5; j++) {
        int nO = 0;
        int nX = 0;
        int nD = 0;
        for (int k=0; k<5; k++) {
          if (board[i+k][j+k]=='O') {
            nO++;
          } else if (board[i+k][j+k]=='X')
            nX++;
          else
            nD++;
        }
        if (nX==4 && nD==1)
          poss = true;
      }
    }
    for (int i=0; i<n-5; i++) {
      for (int j=5; j<n; j++) {
        int nO = 0;
        int nX = 0;
        int nD = 0;
        for (int k=0; k<5; k++) {
          if (board[i+k][j-k]=='O') {
            nO++;
          } else if (board[i+k][j-k]=='X')
            nX++;
          else
            nD++;
        }
        if (nX==4 && nD==1)
          poss = true;
      }
    }
    if (poss)
      System.out.println("YES");
    else
      System.out.println("NO");
  }
}

/*
 * Remember a 2.0 student can know more than a 4.0 student.
 * Grades don't determine intelligence, they test obedience.
 * I Never Give Up.
 */
import java.util.*;
import java.io.*;

import static java.lang.System.out;
//import static java.lang.Math.pow;
//import static java.lang.Math.sqrt;
//import static java.lang.Math.ceil;
import static java.lang.Math.abs;
//import static java.lang.Math.min;
//import static java.lang.Math.max;
//import static java.lang.Math.floor;
public class ContestMain {
	private static long MOD=1000000007;//10^9+7
	private static final int N=(int) 2e5+5; //200005
//	private static ArrayList<Integer> v[]=new ArrayList[N];
//	private static boolean mark[]=new boolean [N];
//	static int choice=Integer.MAX_VALUE,trav=Integer.MAX_VALUE;
	static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

	public static void solve(String ar[]){
		int x=0,y=0;
		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				if(ar[i].charAt(j)=='X'){
					x=i;
					y=j;
					break;
				}
			}
		}
		int cnt=0,dot=0;
		for(int i=0;i<5;i++){
			if(x+i>=10||ar[x+i].charAt(y)=='O'){cnt=0;break;}
			else if(ar[x+i].charAt(y)=='X')cnt++;
			else dot++;
		}
		if(cnt+dot!=5){cnt=0;dot=0;}
		for(int i=0;i<5&&cnt+dot!=5;i++){
			if(x-i<0||ar[x-i].charAt(y)=='O'){cnt=0;break;}
			else if(ar[x-i].charAt(y)=='X')cnt++;
			else dot++;
		}
		if(cnt+dot!=5){cnt=0;dot=0;}
		for(int i=0;i<5&&cnt+dot!=5;i++){
			if(y+i>=10||ar[x].charAt(y+i)=='O'){cnt=0;break;}
			else if(ar[x].charAt(y+i)=='X')cnt++;
			else if(ar[x].charAt(y+i)=='.') dot++;
		}
		if(cnt+dot!=5){cnt=0;dot=0;}
		for(int i=0;i<5&&cnt+dot!=5;i++){
			if(y-i<0||ar[x].charAt(y-i)=='O'){cnt=0;break;}
			else if(ar[x].charAt(y-i)=='X')cnt++;
			else dot++;
		}
		if(cnt+dot!=5){cnt=0;dot=0;}
		for(int i=0;i<5&&cnt+dot!=5;i++){
			if(y+i>=10&&x+i>=10||ar[x+i].charAt(y+i)=='O'){cnt=0;break;}
			else if(ar[x+i].charAt(y+i)=='X')cnt++;
			else dot++;
		}
		if(cnt+dot!=5){cnt=0;dot=0;}
		for(int i=0;i<5&&cnt+dot!=5;i++){
			if(y-i<0&&x-i<0||ar[x-i].charAt(y-i)=='O'){cnt=0;break;}
			else if(ar[x-i].charAt(y-i)=='X')cnt++;
			else dot++;
		}
		if(cnt+dot==5)out.println("YES");
		else out.println("NO");
	}

	public static void main(String[] args) throws IOException{
		String ar[]=new String[10];
		for(int i=0;i<10;i++){
			ar[i]=br.readLine();
		}
		solve(ar);
	}

	/* My Reader Class */
	private static class Reader{
		final private int BUFFER_SIZE=1<<16;
		private DataInputStream din;
		private byte buffer[];
		private int bufferPointer,bytesRead;

		Reader(){
			din=new DataInputStream(System.in);
			buffer=new byte[BUFFER_SIZE];
			bufferPointer=0;
			bytesRead=0;
		}
		public String readLine() throws IOException{
			byte buf[]=new byte[64];
			int cnt=0,c;
			while((c=read())!=-1){
				if(c=='\n')break;
				buf[cnt++]=(byte)c;
			}
			return new String(buf,0,cnt);
		}
		public int nextInt() throws IOException{
			int num=0;
			byte c=read();
			while(c<=' '){
				c=read();
			}
			boolean neg=(c=='-');
			if(neg)c=read();
			do{
				num=num*10+c-'0';
			}while((c=read())>='0'&&c<='9');
			if(neg)return -num;
			else return num;
		}
		public long nextLong() throws IOException{
			long num=0;
			byte c=read();
			while(c<=' '){
				c=read();
			}
			boolean neg=(c=='-');
			if(neg)c=read();
			do{
				num=num*10+c-'0';
			}while((c=read())>='0'&&c<='9');
			if(neg)return -num;
			else return num;
		}
		public double nextDouble() throws IOException{
			double num=0,div=1;
			byte c=read();
			while(c<=' '){
				c=read();
			}
			boolean neg=(c=='-');
			if(neg)c=read();
			do{
				num=num*10+c-'0';
			}while((c=read())>='0'&&c<='9');
			if(c=='.'){
				while((c=read())>='0'&&c<='9'){
					num+=(c-'0')/(div*=10);
				}
			}
			if(neg)return -num;
			else return num;
		}
		private void fillBuffer() throws IOException{
			bytesRead=din.read(buffer,bufferPointer=0,BUFFER_SIZE);
			if(bytesRead==-1)
				buffer[0]=-1;
		}
		private byte read() throws IOException{
			if(bufferPointer==bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}
	}
}

import java.io.*;
import java.util.*;

public class Main {

    public static void main (String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        char[][] grid = new char[10][10];
        for (int i = 0; i < 10; i++) {
            String string = in.readLine();
            for (int j = 0; j < 10; j++) {
                grid[i][j] = string.charAt(j);
            }
        }
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                if (grid[i][j] == '.') {
                    int right = 0;
                    for (int k = 1; true; k++) {
                        if (j+k >= 10) {
                            break;
                        }
                        if (grid[i][j+k] != 'X') {
                            break;
                        }
                        right++;
                    }
                    for (int k = 1; true; k++) {
                        if (j-k < 0) {
                            break;
                        }
                        if (grid[i][j-k] != 'X') {
                            break;
                        }
                        right++;
                    }
                    right++;
                    if (right >= 5) {
                        System.out.println("YES");
                        return;
                    }
                    right = 0;
                    for (int k = 1; true; k++) {
                        if (i+k >= 10) {
                            break;
                        }
                        if (grid[i+k][j] != 'X') {
                            break;
                        }
                        right++;
                    }
                    for (int k = 1; true; k++) {
                        if (i-k < 0) {
                            break;
                        }
                        if (grid[i-k][j] != 'X') {
                            break;
                        }
                        right++;
                    }
                    right++;
                    if (right >= 5) {
                        System.out.println("YES");
                        return;
                    }
                }
            }
        }
        System.out.println("NO");
    }

}
/*

 */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner s= new Scanner(System.in);
		String[] s1 =new String[10];
		for(int i=0;i<10;i++){
			s1[i]= s.next();
		}
		boolean flag= false;
		for(int i=0;i<10;i++){
			if(s1[i].contains("XXXX.") || s1[i].contains(".XXXX") || s1[i].contains("X.XXX") || s1[i].contains("XX.XX") || s1[i].contains("XXX.X")){
				System.out.println("Yes");
				flag=true;
				break;
			}
		}
		if(!flag){
			for(int i=0;i<10;i++){
				String test ="";
				for(int j=0;j<10;j++){
					test = test+Character.toString(s1[j].charAt(i));
				}
				if(test.contains("XXXX.") || test.contains(".XXXX") || test.contains("X.XXX") || test.contains("XX.XX") || test.contains("XXX.X")){
					System.out.println("Yes");
				flag=true;
				break;
				}
			}
		}
		if(!flag){
			for(int i=0;i<5;i++){
				String test ="";
				for(int j=0,k=i;k<10;j++,k++){
					test = test+Character.toString(s1[k].charAt(j));
				}
				if(test.contains("XXXX.") || test.contains(".XXXX") || test.contains("X.XXX") || test.contains("XX.XX") || test.contains("XXX.X")){
					System.out.println("Yes");
				flag=true;
				break;
				}
			}
		}
		if(!flag){
			for(int i=1;i<5;i++){
				String test ="";
				for(int j=0,k=i;k<10;j++,k++){
					test = test+Character.toString(s1[j].charAt(k));
				}
				if(test.contains("XXXX.") || test.contains(".XXXX") || test.contains("X.XXX") || test.contains("XX.XX") || test.contains("XXX.X")){
					System.out.println("Yes");
				flag=true;
				break;
				}
			}
		}
		if(!flag){
			for(int i=0;i<5;i++){
				String test ="";
				for(int j=9,k=i;k<10;j--,k++){
					test = test+Character.toString(s1[k].charAt(j));
				}
				if(test.contains("XXXX.") || test.contains(".XXXX") || test.contains("X.XXX") || test.contains("XX.XX") || test.contains("XXX.X")){
					System.out.println("Yes");
				flag=true;
				break;
				}
			}
		}
		if(!flag){
			for(int i=1;i<5;i++){
				String test ="";
				for(int j=9,k=i;k<10;j--,k++){
					test = test+Character.toString(s1[j].charAt(k));
				}
				if(test.contains("XXXX.") || test.contains(".XXXX") || test.contains("X.XXX") || test.contains("XX.XX") || test.contains("XXX.X")){
					System.out.println("Yes");
				flag=true;
				break;
				}
			}
		}
		if(!flag){
		    System.out.println("No");
		}
	}

}

import java.util.Scanner;

public class MainB {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[][] array = new char[10][10];
		for(int i=0; i<10; i++) {
			String str = in.nextLine();
			for(int j=0; j<10; j++) {
				array[i][j] = str.charAt(j);
			}
		}
		for(int i=0; i<10; i++) {
			for(int j=0; j<10; j++) {
				if(array[i][j] == '.' && !isAlone(array, i, j)) {
					array[i][j] = 'X';
					for(int m=0; m<10; m++) {
						for(int n=0; n<10; n++) {
							if(array[m][n] == 'X') {
								if(hasFiveInVer(array, m, n) || hasFiveInHor(array, m, n) || hasFiveInDia1(array, m, n) || hasFiveInDia2(array, m, n)) {
									System.out.println("YES");
									in.close();
									return;
								}
							}
						}
					}

					array[i][j] = '.';
				}
			}
		}
		System.out.println("NO");

		in.close();
	}

	public static boolean isAlone(char[][] array, int x, int y) {
		if(x > 0 && x < 9 && y > 0 && y < 9) {
			if(array[x-1][y-1] == 'X' || array[x-1][y] == 'X' || array[x-1][y+1] == 'X'
					|| array[x][y-1] == 'X' || array[x][y+1] == 'X'
					|| array[x+1][y-1] == 'X' || array[x+1][y] == 'X' || array[x+1][y+1] == 'X') {
				return false;
			}
		}else if(x == 0 && y > 0 && y < 9) {
			if(array[x][y-1] == 'X' || array[x][y+1] == 'X' || array[x+1][y-1] == 'X' || array[x+1][y] == 'X' || array[x+1][y+1] == 'X') {
				return false;
			}
		}else if(x == 9 && y > 0 && y < 9) {
			if(array[x][y-1] == 'X' || array[x][y+1] == 'X' || array[x-1][y-1] == 'X' || array[x-1][y] == 'X' || array[x-1][y+1] == 'X') {
				return false;
			}
		}else if(y == 0 && x > 0 && x < 9) {
			if(array[x-1][y] == 'X' || array[x+1][y] == 'X' || array[x+1][y+1] == 'X' || array[x][y+1] == 'X' || array[x-1][y+1] == 'X') {
				return false;
			}
		}else if(y == 9 && x > 0 && x < 9) {
			if(array[x-1][y] == 'X' || array[x+1][y] == 'X' || array[x+1][y-1] == 'X' || array[x][y-1] == 'X' || array[x-1][y-1] == 'X') {
				return false;
			}
		}
		return true;
	}

	public static boolean hasFiveInHor(char[][] array, int x, int y) {
		if(y > 5)
			return false;
		for(int j = y; j < y+5; j++) {
			if(array[x][j] != 'X')
				return false;
		}
		return true;
	}

	public static boolean hasFiveInVer(char[][] array, int x, int y) {
		if(x > 5)
			return false;
		for(int i = x; i < x+5; i++) {
			if(array[i][y] != 'X')
				return false;
		}
		return true;
	}

	public static boolean hasFiveInDia1(char[][] array, int x, int y) {
		if(x > 5 || y > 5)
			return false;
		for(int i=x; i<x+5; i++) {
			for(int j=y; j<y+5; j++) {
				if(array[i][j] != 'X')
					return false;
			}
		}
		return true;
	}

	public static boolean hasFiveInDia2(char[][] array, int x, int y) {
		if(x > 5 || y < 4)
			return false;
		for(int i=x; i<x+5; i++) {
			for(int j=y; j>y-5; j--) {
				if(array[i][j] != 'X')
					return false;
			}
		}
		return true;
	}

}

/*
 * UMANG PANCHAL
 * DAIICT
 */

import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.util.Comparator;
public class Main
{

	private static final Comparator<? super Integer> Comparator = null;
	static LinkedList<Integer> adj[];
	static ArrayList<Integer> adj1[];
	static int[] color,visited1;
	static boolean b[],visited[],possible;
	static int level[];
	static Map<Integer,HashSet<Integer>> s;
	static int totalnodes,colored;
	static int count[];
	static long sum[];
	static int nodes;
	static long ans=0;
	static long[] as=new long[10001];
	static long c1=0,c2=0;
	static int[] a,d,k;
	static int max=100000000;
	static long MOD = 1000000007,sm=0,m=Long.MIN_VALUE;
	static boolean[] prime=new boolean[1000005];
	static int[] levl;
    static int[] eat;
    static int price[];
    static int res[],par[];
    static int result=0;
    static int[] root,size;
    static boolean yes = true;
    static long p=Long.MAX_VALUE;
	// --------------------My Code Starts Here----------------------

	public static void main(String[] args) throws IOException
	{
		in=new InputReader(System.in);
		w=new PrintWriter(System.out);

      char[][] c=new char[10][10];
      for(int i=0;i<10;i++)
      {
    	  String s=ns();
    	  for(int j=0;j<10;j++)
    	  {
    		  c[i][j]=s.charAt(j);
    	  }
      }
      boolean ans=false;
      for(int i=0;i<10;i++)
      {

    	  for(int j=0;j<=5;j++)
    	  {
    		  int x=0,d=0;
    		  for(int k=j;k<j+5;k++)
    		  {
    			  if(c[i][k]=='X')
        			  x++;
        		  else if(c[i][k]=='.')
        		      d++;
    		  }
    		  if(x==4 && d==1)
        	  {
        		  ans=true;
        		  break;
        	  }
    	  }
    	  if(ans==true)
    		  break;

      }
      if(ans==false)
      {
    	   for(int i=0;i<10;i++)
    	      {

    	    	  for(int j=0;j<=5;j++)
    	    	  {
    	    		  int x=0,d=0;
    	    		  for(int k=j;k<j+5;k++)
    	    		  {
    	    			  if(c[k][i]=='X')
    	        			  x++;
    	        		  else if(c[k][i]=='.')
    	        		      d++;
    	    		  }
    	    		  if(x==4 && d==1)
        	    	  {
        	    		  ans=true;
        	    		  break;
        	    	  }
    	    	  }
    	    	  if(ans==true)
    	    		  break;

    	      }
      }

      if(ans==false)
    	  w.print("No");
      else
    	  w.print("Yes");
	    w.close();
    }

	// --------------------My Code Ends Here------------------------

	public static long dfs(int i)
	{

	    long min=a[i];
		visited[i]=true;
		for(int j=0;j<adj[i].size();j++)
		{
			if(!visited[adj[i].get(j)])
			{
				min=Math.min(min,dfs(adj[i].get(j)));
			}
		}
	  return min;
	}
	public static void pa(int[] a)
	{
		for(int i=0;i<a.length;i++)
			w.print(a[i]+" ");
		w.println();
	}
	public static void bfs(int i)
	{

	  Queue<Integer> q=new LinkedList<Integer>();
	 q.add(i);

	 level[i]=1;
	 while(!q.isEmpty())
	 {
		 int d=q.poll();
		 for(int j=0;j<adj[d].size();j++)
		 {
			 int x=adj[d].get(j);
			 level[x]=level[d]+1;
			 q.add(x);
		 }

	 }

	}

	 public static void buildgraph(int n)
	 {
         adj=new LinkedList[n];
         visited=new boolean[n];
         level=new int[n];
         par=new int[n];
         for(int i=0;i<n;i++)
         	{
        	 adj[i]=new LinkedList<Integer>();

         	}

	 }

	/*public static long kruskal(Pair[] p)
	{
		long ans=0;
		int w=0,x=0,y=0;
		for(int i=0;i<p.length;i++)
		{
			w=p[i].w;
			x=p[i].x;
			y=p[i].y;
			if(root(x)!=root(y))
			{
				ans+=w;
				union(x,y);
			}
		}
		return ans;
	}*/

	 static class Pair implements Comparable<Pair>
	 {
		Integer x,y;

		Pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}
		public int compareTo(Pair o)
		{
		  return y-o.y;

		}

	}

	  public static  long maxSubArraySum(int a[], int size)
      {
         long max_so_far = a[0];
         long curr_max = a[0];

         for (int i = 1; i < size; i++)
         {
              curr_max = Math.max(a[i], curr_max+a[i]);
              max_so_far = Math.max(max_so_far, curr_max);
         }
         return max_so_far;
      }

	public static int root(int i)
	{
		while(root[i]!=i)
		{
			root[i]=root[root[i]];
			i=root[i];
		}
		return i;
	}

	public static void init(int n)
	{
		root=new int[n+1];
		for(int i=1;i<=n;i++)
			root[i]=i;
	}
	public static void union(int a,int b)
	{
	    int root_a=root(a);
	    int root_b=root(b);
	    root[root_a]=root_b;
	   // size[root_b]+=size[root_a];
	}

	public static long nCrModp(long n, long r, long p)
	{

	    long[] C=new long[(int)r+1];

	    C[0] = 1;

	    for (long i = 1; i <= n; i++)
	    {

	        for (long j = Math.min(i, r); j > 0; j--)

	            C[(int)j] = (C[(int)j] + C[(int)(j-1)])%p;
	    }
	    return C[(int)r];
	}
	public static long nCr(long n, long r)
	{
		long x=1;
		for(long i=n;i>=n-r+1;i--)
			x=((x)*(i));
		for(long i=r;i>=1;i--)
			x=((x)/(i));

		return x%MOD;
	}
	public static long nCrModpDP(long n, long r, long p)
	{

	    long[] C=new long[(int)r+1];

	    C[0] = 1;

	    for (long i = 1; i <= n; i++)
	    {
	        for (int j = (int)Math.min(i, r); j > 0; j--)
	           C[j] = (C[j] + C[j-1])%p;
	    }
	    return C[(int)r];
	}

	public static long nCrModpLucas(long n,long r, long p)
	{

	   if (r==0)
	      return 1;

	   long ni = n%p, ri = r%p;

	   return (nCrModpLucas(n/p,r/p, p) * nCrModpDP(ni,ri, p)) % p;
	}

	public static int getSum(long BITree[], int index)
	{
	    int sum = 0;

	    while (index > 0)
	    {
	        sum += BITree[index];
	        index -= index & (-index);
	    }
	    return sum;
	}

	public static long[] updateBIT(long BITree[], int n, int index, int val)
	{
	    while (index <= n)
	    {
	       BITree[index] += val;
	       index += index & (-index);
	    }
	    return BITree;
	}

	public static boolean isPrime(int n)
	{
	    // Corner cases
	    if (n <= 1)  return false;
	    if (n <= 3)  return true;

	    // This is checked so that we can skip
	    // middle five numbers in below loop
	    if (n%2 == 0 || n%3 == 0)
	    	return false;

	    for (int i=5; i*i<=n; i=i+6)
	        if (n%i == 0 || n%(i+2) == 0)
	           return false;

	    return true;
	}

	public static String ns()
	{
		return in.nextLine();
	}
	public static int ni()
	{
		return in.nextInt();
	}
	public static long nl()
	{
		return in.nextLong();
	}
	public static int[] na(int n)
	{
		a=new int[n];
		for(int i=0;i<n;i++)
		a[i]=ni();
		return a;
	}
	public static void sieveOfEratosthenes()
	    {
	       int n=prime.length;
	        for(int i=0;i<n;i++)
	            prime[i] = true;

	        for(int p = 2; p*p <=n; p++)
	        {
	            if(prime[p] == true)
	            {
	                for(int i = p*2; i <n; i += p)
	                    prime[i] = false;
	            }
	        }
	    }

	public static boolean printDivisors(long n)
    {
		long ans=0;
        for (int i=1; i<=Math.sqrt(n); i++)
        {
            if (n%i==0)
            {
                if (n/i == i)
                    ans++;
                else
                {
                	ans=ans+2;
                }
            }
            if(ans>3)
            	break;
        }
        if(ans==3)
        	return true;
        else
        	return false;
    }

  public static String rev(String s)
	{
		StringBuilder sb=new StringBuilder(s);
		sb.reverse();
		return sb.toString();
	}
	static long lcm(long a, long b)
	{
	    return a * (b / gcd(a, b));
	}
	static long gcd(long a, long b)
	{
	    while (b > 0)
	    {
	        long temp = b;
	        b = a % b; // % is remainder
	        a = temp;
	    }
	    return a;
	}
	static InputReader in;
	static PrintWriter w;
static class InputReader
{

private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
private SpaceCharFilter filter;

public InputReader(InputStream stream)
{
  this.stream = stream;
}

public int snext()
{
  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 nextInt()
{
  int c = snext();
  while (isSpaceChar(c))
  {
    c = snext();
  }
  int sgn = 1;
  if (c == '-')
  {
    sgn = -1;
    c = snext();
  }
  int res = 0;
  do
  {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = snext();
  }
  while (!isSpaceChar(c));
  return res * sgn;
}

public long nextLong()
{
  int c = snext();
  while (isSpaceChar(c))
  {
    c = snext();
  }
  int sgn = 1;
  if (c == '-')
  {
    sgn = -1;
    c = snext();
  }
  long res = 0;
  do
  {
    if (c < '0' || c > '9')
      throw new InputMismatchException();
    res *= 10;
    res += c - '0';
    c = snext();
  }
  while (!isSpaceChar(c));
  return res * sgn;
}
public String readString()
{
  int c = snext();
  while (isSpaceChar(c))
  {
    c = snext();
  }
  StringBuilder res = new StringBuilder();
  do
  {
    res.appendCodePoint(c);
    c = snext();
  }
  while (!isSpaceChar(c));
  return res.toString();
}

public String nextLine()
{
  int c = snext();
  while (isSpaceChar(c))
    c = snext();
  StringBuilder res = new StringBuilder();
  do
  {
    res.appendCodePoint(c);
    c = snext();
  }
  while (!isEndOfLine(c));
  return res.toString();
}

public boolean isSpaceChar(int c)
{
  if (filter != null)
    return filter.isSpaceChar(c);
  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}

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

public interface SpaceCharFilter
{
  public boolean isSpaceChar(int ch);
}
}

}

import java.io.*;
import java.lang.reflect.Array;
import java.math.*;
import java.security.KeyStore.Entry;
import java.util.*;

public class Main {
	private InputStream is;
	private PrintWriter out;
	int time = 0, dp[][], DP[][], dist[], prime[], start[], parent[], end[],
			val[], black[], arr[], arr1[][];
	long MOD = (long) (1e9 + 9);
	ArrayList<Integer>[] amp;
	boolean b[], b1[];
	Pair prr1[];
	char ch[][], c[];
	HashSet<Integer> hs1 = new HashSet<>(), hs2 = new HashSet<>();

	public static void main(String[] args) throws Exception {
		new Thread(null, new Runnable() {
			public void run() {
				try {

					// new Main().soln();
				} catch (Exception e) {
					System.out.println(e);
				}
			}
		}, "1", 1 << 26).start();
		new Main().soln();
	}

	int MAX = 1000010, N, K;
	double Q = 1;
	double a = 1 , fa = 0;
	long B = 0;
	PriorityQueue<Pair> pq;
	int Dp[][] = new int[1010][1010];
	int MOD1 = 1000000007, MOD2 = 1000000009;
	void solve() {
		char ch[][] = new char[10][10];
		for(int i = 0;i<10;i++){
			ch[i] = ns().toCharArray();
		}
		for(int i = 0;i<10;i++){
			for(int j = 0;j<10;j++){
				if(check(ch,i,j)) {
					//System.out.println(i+" "+j);
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}
	boolean check(char ch[][], int i, int j){
		if(ch[i][j]=='O') return false;
		char c = ch[i][j];
		ch[i][j] = 'X';
		if(i>=4){
			int x = 0;
			int l = 0;
			for(x = 0;x<=4;x++){
				if(ch[i-x][j]!='X'){ if(ch[i-x][j]!='.') break;else l++;}
			}
			if(x==5 && l<=1) return true;
			l = 0;
			if(j>=4){
				for(x = 0;x<=4;x++){
					if(ch[i-x][j-x]!='X'){ if(ch[i-x][j-x]!='.') break; else l++;}
				}
				if(x==5 && l<=1) return true;
				 l =0;
				for(x = 0;x<=4;x++){
					if(ch[i][j-x]!='X'){ if(ch[i][j-x]!='.') break; else l++;}
				}
				if(x==5 && l<=1) return true;
			}
			if(j<=5){
				l = 0;
				for(x = 0;x<=4;x++){
					if(ch[i][j+x]!='X'){ if(ch[i][j+x]!='.') break; else l++;}
				}
				if(x==5 && l<=1) return true;
				l = 0;
				for(x = 0;x<=4;x++){
					if(ch[i-x][j+x]!='X'){ if(ch[i-x][j+x]!='.') break; else l++;}
				}
				if(x==5 && l<=1) return true;
			}
		}
		else{
			int x = 0;
			int l = 0;
			for(x = 0;x<=4;x++){
				if(ch[i+x][j]!='X'){ if(ch[i+x][j]!='.') break; else l++;}
			}
			if(x==5 && l<=1) return true;
			l = 0;
			if(j>=4){
				for(x = 0;x<=4;x++){
					if(ch[i+x][j-x]!='X'){ if(ch[i+x][j-x]!='.') break; else l++;}
				}
				if(x==5 && l<=1) return true;
				 l =0;
				for(x = 0;x<=4;x++){
					if(ch[i][j-x]!='X'){ if(ch[i][j-x]!='.') break; else l++;}
				}
				if(x==5 && l<=1) return true;
			}
			if(j<=5){
				l = 0;
				for(x = 0;x<=4;x++){
					if(ch[i][j+x]!='X'){ if(ch[i][j+x]!='.') break; else l++;}
				}
				if(x==5 && l<=1) return true;
				l = 0;
				for(x = 0;x<=4;x++){
					if(ch[i+x][j+x]!='X'){ if(ch[i+x][j+x]!='.') break; else l++;}
				}
				if(x==5 && l<=1) return true;
			}
		}
		ch[i][j] = c;
		return false;
	}
	int dfs(int x){
		b[x] = true;
		for(int i:amp[x]){
			if(!b[i]){
				parent[i] = x;
				dist[x] += dfs(i);
			}
		}
		return (++dist[x]);
	}
	void buildGraph(int n){
		while(n-->0){
			int x= ni()-1, y = ni()-1;
			amp[x].add(y);
			amp[y].add(x);
		}
	}
	void recur(int x, int y, int p){
		int val = 0;
		if(x>y || y<x) return;
		if(x>0){
			if(p==1){
				val = arr[x]-arr[x-1];
			}
			if(p==3){
				if(arr[x]-arr[x-1]<K){
					recur(x+1,y,3);
				}
				else val = arr[x]-arr[x-1];
			}
		}
		if(y<N){
			if(p==4){
				B += arr[y+1]-arr[y];
			}
			if(p==2){
				if(arr[y+1]-arr[y]<K){
					recur(x,y-1,2);
				}
				else val = arr[y+1]-arr[y];
			}
		}
		B += val;
		if(x==y){
			System.out.println(B+" "+a);
			fa += B*a;
		}
		//System.out.println(Q);
		a*=Q;
		recur(x+1,y,1);
		recur(x,y-1,2);
		a/=Q;
		a*=(1-Q);
		recur(x+1,y,3);
		recur(x,y-1,4);
		a/=(1-Q);
		B -= val;
		//System.out.println(a+" "+B);
	}
	class cell implements Comparable<cell>{
		char ch;
		int i;
		cell(char c, int x){
			ch = c;
			i = x;
		}
		public boolean equals(Object o) {
			cell other = (cell) o;
			return ((ch == other.ch && i == other.i));// || (v == other.u && u ==
			// other.v));
		}
		@Override
		public int compareTo(cell c) {
			if(this.ch<c.ch) return -1;
			if(this.ch==c.ch) {
				if(this.i<c.i)return 1;
				if(this.i==c.i) return 0;
				return -1;
			}
			return 1;
		}

		public String toString() {
			return "[u=" + ch + ", v=" + i + "]";
		}

	}
	int T[] = new int[100010], L[] = new int[100010];
	int P[][] = new int[100010][30];

	void process3(int N) {
		int i, j;

		// we initialize every element in P with -1
		for (i = 0; i < N; i++)
			for (j = 0; 1 << j < N; j++)
				P[start[i]][j] = -1;

		// the first ancestor of every node i is T[i]
		for (i = 0; i < N; i++)
			P[start[i]][0] = T[i];

		// bottom up dynamic programing
		for (j = 1; 1 << j < N; j++)
			for (i = 0; i < N; i++)
				if (P[start[i]][j - 1] != -1)
					P[start[i]][j] = P[P[start[i]][j - 1]][j - 1];
	}

	int query(int p, int q) {
		int tmp = 0, log = 0, i = 0;

		// if p is situated on a higher level than q then we swap them
		if (L[p] < L[q])
			tmp = p;
		p = q;
		q = tmp;

		// we compute the value of [log(L[p)]
		for (log = 1; 1 << log <= L[p]; log++)
			;
		log--;

		// we find the ancestor of node p situated on the same level
		// with q using the values in P
		for (i = log; i >= 0; i--)
			if (L[p] - (1 << i) >= L[q])
				p = P[p][i];

		if (p == q)
			return p;

		// we compute LCA(p, q) using the values in P
		for (i = log; i >= 0; i--)
			if (P[p][i] != -1 && P[p][i] != P[q][i])
				p = P[p][i];
		q = P[q][i];

		return T[p];
	}

	long ans = 0;

	void recur(int i, int k, long sum) {
		if (k > K)
			return;
		if (k == K) {
			ans = Math.max(ans, sum);
		}
		for (int j = i; j < N; j++) {

			recur(j + 1, k + 1, sum);
		}
	}

	long[] mul(long arr[][], long temp[]) {
		long ans[] = new long[temp.length];
		for (int i = 0; i < arr.length; i++) {
			long sum = 0;
			for (int j = 0; j < arr.length; j++) {
				sum = (sum + arr[i][j] * temp[j]) % MOD;
			}
			ans[i] = sum;
		}
		return ans;
	}

	void printMat(long arr[][]) {
		for (int i = 0; i < arr.length; i++) {
			for (int j = 0; j < arr.length; j++) {
				System.out.print(arr[i][j] + " ");
			}
			System.out.println();
		}
		System.out.println("-----");
	}

	void printMat(long arr[]) {
		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		System.out.println("-----");
	}

	long[][] matMul(int n, long arr[][], long y) {
		long iden[][] = new long[n][n];
		for (int i = 0; i < n; i++)
			iden[i][i] = 1;
		// printMat(iden);
		while (y > 0) {
			if (y % 2 == 1) {
				iden = mul(n, iden, arr);
				// printMat(iden);
				y--;
			} else {
				arr = mul(n, arr, arr);
				// printMat(arr);
				y /= 2;
			}
		}
		return iden;
	}

	long[][] mul(int n, long a1[][], long a2[][]) {
		long temp[][] = new long[n][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				long sum = 0;
				for (int k = 0; k < n; k++) {
					sum = (sum + a1[i][k] * a2[k][j]) % MOD;
				}
				temp[i][j] = sum;
			}
		}
		return temp;
	}

	void seive(int n) {
		b = new boolean[n + 1];
		prime = new int[n + 1];
		for (int i = 2; i * i <= n; i++) {
			if (!b[i]) {
				for (int j = 2 * i; j <= n; j += i) {
					if (!b[j]) {
						b[j] = true;
						prime[j] = i;
					}
				}
			}
		}
	}

	int binarySearch1(int arr[], int x) {
		int ans = -1;
		int low = 0, high = arr.length - 1;
		while (high >= low) {
			int mid = (low + high) / 2;
			if (arr[mid] >= x) {
				ans = mid;
				high = mid - 1;
			} else
				low = mid + 1;
		}
		return ans;
	}

	int binarySearch2(Integer arr[], int x) {
		int ans = -1;
		int low = 0, high = arr.length - 1;
		while (high >= low) {
			int mid = (low + high) / 2;
			if (arr[mid] >= x) {
				ans = mid;
				low = mid + 1;
			} else
				high = mid - 1;
		}
		return ans + 1;
	}

	int cntEven(String str) {
		int cnt = 0;
		for (int i = str.length() - 1; i >= 0; i--) {
			if ((str.charAt(i) - '0') % 2 == 0) {
				cnt++;
			}
		}
		return cnt;
	}

	int max = 0;

	int getParent(int x) {
		// System.out.println(x+" "+parent[x]);
		if (parent[x] != x) {
			parent[x] = getParent(parent[x]);
		}
		return parent[x];
	}

	class Pair implements Comparable<Pair> {
		int u;
		int v, r, i;

		Pair(int u, int v, int r, int i) {
			this.u = u;
			this.v = v;
			this.r = r;
			this.i = i;
		}

		Pair(int u, int v, int r) {
			this.u = u;
			this.v = v;
			this.r = r;
		}

		Pair(int u, int v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			return Objects.hash();
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return ((u == other.u && v == other.v));// || (v == other.u && u ==
			// other.v));
		}

		public int compareTo(Pair other) {
			//return Long.compare(r, other.r);
			 return Long.compare(u, other.u) != 0 ? (Long.compare(u, other.u))
			 : (Long.compare(v, other.v));
			// :(Long.compare(other.r, r))) ;
		}

	}

	int min(int x, int y) {
		if (x < y)
			return x;
		return y;
	}

	int max(int x, int y) {
		if (x > y)
			return x;
		return y;
	}

	long modInverse(long a, long mOD2) {
		return power(a, mOD2 - 2, mOD2);
	}

	long power(long x, long y, long m) {
		if (y == 0)
			return 1;
		long p = power(x, y / 2, m) % m;
		p = (p * p) % m;

		return (y % 2 == 0) ? p : (x * p) % m;
	}

	boolean isPrime(int x) {
		for (int i = 2; i * 1L * i <= x; i++)
			if (x % i == 0)
				return false;
		return true;
	}

	public long gcd(long a, long b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

	void failFn(String str, int arr[]) {
		int len = 0;
		arr[0] = 0;
		int i = 1;
		while (i < arr.length) {
			if (str.charAt(i) == str.charAt(len)) {
				arr[i++] = ++len;
				continue;
			}
			if (len == 0) {
				arr[i] = len;
				i++;
				continue;
			}
			if (str.charAt(i) != str.charAt(len)) {
				len = arr[len - 1];
			}
		}
	}

	static class ST1 {
		int arr[], st[], size;

		ST1(int a[]) {
			arr = a.clone();
			size = 10 * arr.length;
			st = new int[size];
			build(0, arr.length - 1, 1);
		}

		void build(int ss, int se, int si) {
			if (ss == se) {
				st[si] = arr[ss];
				return;
			}
			int mid = (ss + se) / 2;
			int val = 2 * si;
			build(ss, mid, val);
			build(mid + 1, se, val + 1);
			st[si] = (st[val] + st[val + 1]);
		}

		int get(int ss, int se, int l, int r, int si) {
			if (l > se || r < ss || l > r)
				return Integer.MAX_VALUE;
			if (l <= ss && r >= se)
				return st[si];
			int mid = (ss + se) / 2;
			int val = 2 * si;
			return (get(ss, mid, l, r, val) + get(mid + 1, se, l, r, val + 1));
		}
	}

	static class ST {
		int arr[], lazy[], n;

		ST(int a) {
			n = a;
			arr = new int[10 * n];
			lazy = new int[10 * n];
		}

		void up(int l, int r, int val) {
			update(0, n - 1, 0, l, r, val);
		}

		void update(int l, int r, int c, int x, int y, int val) {
			if (lazy[c] != 0) {
				lazy[2 * c + 1] ^= lazy[c];
				lazy[2 * c + 2] ^= lazy[c];
				if (l == r)
					arr[c] ^= lazy[c];
				lazy[c] = 0;
			}
			if (l > r || x > y || l > y || x > r)
				return;
			if (x <= l && y >= r) {
				if ((r - l + 1) % 2 == 1)
					lazy[c] ^= val;
				return;
			}
			int mid = l + r >> 1;
		update(l, mid, 2 * c + 1, x, y, val);
		update(mid + 1, r, 2 * c + 2, x, y, val);
		arr[c] = (arr[2 * c + 1] + arr[2 * c + 2]);
		}

		int an(int ind) {
			return ans(0, n - 1, 0, ind);
		}

		int ans(int l, int r, int c, int ind) {
			if (lazy[c] != 0) {
				lazy[2 * c + 1] += lazy[c];
				lazy[2 * c + 2] += lazy[c];
				if (l == r)
					arr[c] += lazy[c];
				lazy[c] = 0;
			}
			if (l == r)
				return arr[c];
			int mid = l + r >> 1;
		if (mid >= ind)
			return ans(l, mid, 2 * c + 1, ind);
		return ans(mid + 1, r, 2 * c + 2, ind);
		}
	}
	static long[] array;
	public static class FenwickTree {

		 // 1-indexed array, In this array We save cumulative
		// information to perform efficient range queries and
		// updates

		public FenwickTree(int size) {
			array = new long[size + 1];
		}
		int getSum(int index)
		{
			int sum = 0; // Iniialize result

			// index in BITree[] is 1 more than the index in arr[]
			index = index + 1;

			// Traverse ancestors of BITree[index]
			while (index>0)
			{
				// Add current element of BITree to sum
				sum ^= array[index];

				// Move index to parent node in getSum View
				index -= index & (-index);
			}
			return sum;
		}
		public long rsq(int ind) {
			assert ind > 0;
			long sum = 0;
			ind = ind+1;
			while (ind > 0) {
				sum ^= array[ind];
				// Extracting the portion up to the first significant one of the
				// binary representation of 'ind' and decrementing ind by that
				// number
				ind -= ind & (-ind);
			}
			return sum;
		}

		public long rsq(int a, int b) {
			assert b >= a && a > 0 && b > 0;
			return rsq(b) ^ rsq(a - 1);
		}

		public void update(int ind, long value) {
			assert ind > 0;
			ind = ind+1;
			while (ind < array.length) {
				array[ind] ^= value;
				// Extracting the portion up to the first significant one of the
				// binary representation of 'ind' and incrementing ind by that
				// number
				ind += ind & (-ind);
			}
		}

		public int size() {
			return array.length - 1;
		}
	}

	public static int[] shuffle(int[] a, Random gen) {
		for (int i = 0, n = a.length; i < n; i++) {
			int ind = gen.nextInt(n - i) + i;
			int d = a[i];
			a[i] = a[ind];
			a[ind] = d;
		}
		return a;
	}

	long power(long x, long y, int mod) {
		long ans = 1;
		while (y > 0) {
			if (y % 2 == 0) {
				x = (x * x) % mod;
				y /= 2;
			} else {
				ans = (x * ans) % mod;
				y--;
			}
		}
		return ans;
	}

	void soln() {
		is = System.in;
		out = new PrintWriter(System.out);
		long s = System.currentTimeMillis();
		solve();
		out.close();
		out.flush();
		tr(System.currentTimeMillis() - s + "ms");
	}

	// To Get Input
	// Some Buffer Methods
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
			// ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

	private void tr(Object... o) {
		if (!oj)
			System.out.println(Arrays.deepToString(o));
	}
}

//package Jul22;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

/**
 * Created by kandarp.jo on 22/07/17.
 */
public class B {
    public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    public static PrintWriter out = new PrintWriter(System.out);
    public static void main(String cd[]) throws  Exception{
        char array[][] = new char[10][10];
        for(int i=0;i<10;i++){
            String s = in.readLine();
            for(int j=0;j<10;j++){
                array[i][j] = s.charAt(j);
            }
        }
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                if(array[i][j]=='.'){
                    array[i][j] = 'X';
                    if(check(array)){
                        out.println("YES");
                        out.close();
                        System.exit(0);
                    }
                    array[i][j]='.';
                }
            }
        }
        out.println("NO");
        out.close();

    }
    public static boolean check(char[][] array){
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                char tmp ='X';
                int count =0;
                for(int k=0;k<5;k++){
                    if(j+k <10 && array[i][j+k]==tmp){
                        count++;
                    }
                }
                if(count == 5){
                    return true;
                }
                count=0;
                for(int k=0;k<5;k++){
                    if(i+k<10 && array[i+k][j]==tmp)
                        count++;
                }
                if(count==5){
                    return true;
                }
                count=0;
                for(int k=0;k<5;k++){
                    if(i+k<10 && j+k<10 && array[i+k][j+k]==tmp){
                        count++;
                    }
                }
                if(count==5){
                    return true;
                }
            }

        }
        return false;
    }

}

//package codeforces;

import java.util.Scanner;

public class Task2_4 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[][][] arr = new int[10][10][4];
        boolean needToWork = true;
        for (int i = 0; i < 10; i++) {
            String s = in.nextLine();
            if (needToWork) {
                if (s.contains(".XXXX") || s.contains("X.XXX") || (s.contains("XX.XX")) || (s.contains("XXX.X")) || (s.contains("XXXX.")))
                    needToWork = false;
                else for (int j = 0; j < 10; j++) {
                    Character c = s.charAt(j);
                    if (c == 'O') {
                        arr[i][j][0] = -1;
                        arr[i][j][1] = -1;
                        arr[i][j][2] = -1;
                        arr[i][j][3] = 0;
                    } else if (c == 'X') {
                        if (i > 0) {
                            arr[i][j][0] = arr[i - 1][j][0] + 1;
                            if (j > 0) arr[i][j][1] = arr[i - 1][j - 1][1] + 1;
                            if (j < 9) arr[i][j][2] = arr[i - 1][j + 1][2] + 1;
                        } else {
                            arr[i][j][0] = 1;
                            arr[i][j][1] = 1;
                            arr[i][j][2] = 1;
                        }
                        arr[i][j][3] = 1;
                    } else {
                        if (i > 0) {
                            if (arr[i - 1][j][3] == 1) arr[i][j][0] = arr[i - 1][j][0] + 1;
                            else arr[i][j][0] = 0;
                            if (j > 0)
                                if (arr[i - 1][j - 1][3] == 1)
                                    arr[i][j][1] = arr[i - 1][j - 1][1] + 1;
                                else arr[i][j][1] = 0;
                            if (j < 9)
                                if (arr[i - 1][j + 1][3] == 1)
                                    arr[i][j][2] = arr[i - 1][j + 1][2] + 1;
                                else arr[i][j][2] = 0;
                        } else {
                            arr[i][j][0] = 0;
                            arr[i][j][1] = 0;
                            arr[i][j][2] = 0;
                        }
                        arr[i][j][3] = 2;
                    }
                    if ((arr[i][j][0] == 5) || (arr[i][j][1] == 5) || (arr[i][j][2] == 5))
                        needToWork = false;
                }
            }
        }
        if (needToWork) System.out.println("NO");
        else System.out.println("YES");
    }
}

import java.io.*;
import java.util.*;
@SuppressWarnings("unused")
public class Solution { //Название класса здесь
	private static boolean IOTypeIsFile = false; //Вид ввода/вывода. true-через файл. false-через консоль.
	private static String FileInput = ""; //Название файла ввода
	private static String FileOutput = "name.out";//Название файла вывода
	private static Scanner in;
	private static PrintStream out, err;
	private static String ts(Object a) {
		return String.valueOf(a);
	}
	private static int ti(String a) {
		return Integer.valueOf(a);
	}
	private static double td(String a) { return Double.valueOf(a); }
	private static int[] arrayI(int n) {
		int[] ans = new int[n];
		for (int i = 0; i < n; ++i) {ans[i] = in.nextInt(); }
		return ans;
	}
	private static String[] arrayS(int n) {
		String[] ans = new String[n];
		for (int i = 0; i < n; ++i) { ans[i] = in.next(); }
		return ans;
	}

	private static double[] arrayD(int n) {
		double[] ans = new double[n];
		for (int i = 0; i < n; ++i) { ans[i] = in.nextDouble(); }
		return ans;
	}

	private static void SomeVeryLargeUndUselessFunctionName(){if(!IOTypeIsFile){ err.print(FileInput + FileOutput);}}

	public static void main(String[] args) {
		err = new PrintStream(System.err);
		if (IOTypeIsFile) {
			File f = new File(FileInput);
			try {
				in = new Scanner(f);
				out = new PrintStream(FileOutput);
			} catch (FileNotFoundException var3) {
				System.err.println("404");return;
			}
		} else {
			in = new Scanner(System.in);
			out = new PrintStream(System.out);
		}
		run();
		in.close();
		out.close();
	}

	//Код пишут отсюда
	private static void run() {
		char[][] table=new char[10][10];
		for (int i=0;i<10;i++){
			table[i]=in.nextLine().toCharArray();
		}
		for (int y=0;y<10;y++){
			for (int x=0;x<10;x++){
				if (table[y][x]=='.'){
					int am=1;
					for (int i=x-1;i>=0;i--){
						if (table[y][i]=='X'){am++;}
						else {break;}
					}
					for (int i=x+1;i<10;i++){
						if (table[y][i]=='.'){break;}
						else if (table[y][i]=='X'){am++;}
					}
					if (am>=5){out.println("YES");return;}
					am=1;
					for (int i=y-1;i>=0;i--){
						if (table[i][x]=='X'){am++;}
						else {break;}
					}
					for (int i=y+1;i<10;i++){
						if (table[i][x]=='X'){am++;}
						else {break;}
					}
					if (am>=5){out.println("YES");return;}
					am=1;
					for (int i=y-1,j=x-1;(i>=0)&&(j>=0);i--,j--){
						if (table[i][j]=='X'){am++;}
						else {break;}
					}
					for (int i=y+1,j=x+1;(i<10)&&(j<10);i++,j++){
						if (table[i][j]=='X'){am++;}
						else {break;}
					}
					if (am>=5){out.println("YES");return;}
					am=1;
					for (int i=y-1,j=x+1;(i>=0)&&(j<10);i--,j++){
						if (table[i][j]=='X'){am++;}
						else {break;}
					}
					for (int i=y+1,j=x-1;(i<10)&&(j>=0);i++,j--){
						if (table[i][j]=='X'){am++;}
						else {break;}
					}
					if (am>=5){out.println("YES");return;}
				}
			}
		}
		out.println("NO");
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int[][] mat = new int[10][10];
            for (int i = 0; i < 10; i++) {
                String tmp = in.next();
                for (int j = 0; j < 10; j++) {
                    if (tmp.charAt(j) == '.')
                        mat[i][j] = 0;
                    else if (tmp.charAt(j) == 'X')
                        mat[i][j] = 1;
                    else
                        mat[i][j] = 2;
                }
            }
            for (int i = 0; i < 10; i++) {
                for (int j = 0; j < 10; j++) {
                    if (mat[i][j] != 0)
                        continue;
                    int l = cnt(mat, i, j, -1, 0);
                    int r = cnt(mat, i, j, 1, 0);
                    if (l + r >= 5) {
                        out.println("YES");
                        return;
                    }
                    int t = cnt(mat, i, j, 0, 1);
                    int b = cnt(mat, i, j, 0, -1);
                    if (t + b >= 5) {
                        out.println("YES");
                        return;
                    }
                    int tl = cnt(mat, i, j, -1, 1);
                    int br = cnt(mat, i, j, 1, -1);
                    if (tl + br >= 5) {
                        out.println("YES");
                        return;
                    }
                    int tr = cnt(mat, i, j, 1, 1);
                    int bl = cnt(mat, i, j, -1, -1);
                    if (tr + bl >= 5) {
                        out.println("YES");
                        return;
                    }
                }
            }
            out.println("NO");
        }

        public int cnt(int[][] mat, int x, int y, int dx, int dy) {
            int ret = 0;
            x += dx;
            y += dy;
            while (x >= 0 && x < 10 && y >= 0 && y < 10 && mat[x][y] == 1) {
                x += dx;
                y += dy;
                ret++;
            }
            return ret;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[16384];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

import java.util.Scanner;

public class Main {
	static char[][] field;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		field = new char[10][];
		String s;
		for (int i = 0; i < 10; i++) {
			s = sc.nextLine();
			field[i] = s.toCharArray();
		}
		if (go(0, 0, 1, 0, 0, 1) || go(0, 0, 0, 1, 1, 0) ||
			go(0,0, 0, 1, 1, -1) || go(9, 0, 0, 1, -1, -1)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
	static boolean go(int startX, int startY, int nextX, int nextY, int stepX, int stepY) {
		while (startX >= 0 && startX < 10 && startY >= 0 && startY < 10) {
			int x = startX;
			int y = startY;
			int count = 0;
			int countSolid = 0;
			boolean wasEmpty = false;
			while (x >= 0 && x < 10 && y >= 0 && y < 10) {
				if (field[x][y] == 'O') {
					count = 0;
					countSolid = 0;
					wasEmpty = false;
				} else {
					if (field[x][y] == 'X') {
						countSolid++;
						count++;
					} else {
						if (wasEmpty) {
							count = countSolid + 1;
							countSolid = 0;
						} else {
							count++;
							countSolid = 0;
							wasEmpty = true;
						}
					}
					if (count > 4) return true;
				}
				x += stepX;
				y += stepY;
			}
			startX += nextX;
			startY += nextY;
		}
		return false;
	}
}

//package Jul22;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

/**
 * Created by kandarp.jo on 22/07/17.
 */
public class B {
    public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    public static PrintWriter out = new PrintWriter(System.out);
    public static void main(String cd[]) throws  Exception{
        char array[][] = new char[10][10];
        for(int i=0;i<10;i++){
            String s = in.readLine();
            for(int j=0;j<10;j++){
                array[i][j] = s.charAt(j);
            }
        }
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                if(array[i][j]=='.'){
                    array[i][j] = 'X';
                    if(check(array)){
                        out.println("YES");
                        out.close();
                        System.exit(0);
                    }
                    array[i][j]='.';
                }
            }
        }
        out.println("NO");
        out.close();

    }
    public static boolean check(char[][] array){
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                char tmp ='X';
                int count =0;
                for(int k=0;k<5;k++){
                    if(j+k <10 && array[i][j+k]==tmp){
                        count++;
                    }
                }
                if(count == 5){
                    return true;
                }
                count=0;
                for(int k=0;k<5;k++){
                    if(i+k<10 && array[i+k][j]==tmp)
                        count++;
                }
                if(count==5){
                    return true;
                }
                count=0;
                for(int k=0;k<5;k++){
                    if(i+k<10 && j+k<10 && array[i+k][j+k]==tmp){
                        count++;
                    }
                }
                if(count==5){
                    return true;
                }
                count=0;
                for(int k=0;k<5;k++){
                    if(i-k>0 && j+k<10 && array[i-k][j+k]==tmp){
                        count++;
                    }
                }
                if(count==5){
                    return true;
                }

                count=0;
                for(int k=0;k<5;k++){
                    if(i-k>0 && j-k>0 && array[i-k][j-k]==tmp){
                        count++;
                    }
                }
                if(count==5){
                    return true;
                }

                count=0;
                for(int k=0;k<5;k++){
                    if(i+k<10 && j-k>0 && array[i+k][j-k]==tmp){
                        count++;
                    }
                }
                if(count==5){
                    return true;
                }

            }

        }
        return false;
    }

}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
	static int t,m,mod=998244353,maxn=1000000,q,n,k,cnt=2;
    static long INF=(long)1e18;

    void solve(PrintWriter out, Reader in) throws IOException{
        int[][] arr = new int[10][10];

        for(int i=0;i<10;i++){
            String str = in.next();
            for(int j=0;j<10;j++){
                arr[i][j] = str.charAt(j)=='X' ? 1 : str.charAt(j)=='.' ? 0 : -1;
            }
        }

        int cnt=0;
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                if(j<=5){
                    cnt=0;
                    for(int s=j;s<j+5;s++) cnt+=arr[i][s];
                    if(cnt==4) {out.println("YES");return;}
                }
                if(j<=5 && i<=5){
                    cnt=0;
                    for(int s=0;s<5;s++) cnt+= arr[i+s][j+s];
                    if(cnt==4) {out.println("YES");return;}
                }
                if(j>=4 && i<=5){
                    cnt=0;
                    for(int s=0;s<5;s++) cnt+= arr[i+s][j-s];
                    if(cnt==4) {out.println("YES");return;}
                }
            }
        }
        out.println("NO");
    }

    static class Reader {

    private InputStream mIs;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public Reader() {
        this(System.in);
    }

    public Reader(InputStream is) {
        mIs = is;
    }

    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();

    }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = mIs.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar++];
    }

    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 String next() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

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

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public int nextInt() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

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

    }
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        Reader in = new Reader();
        Main solver = new Main();
        solver.solve(out, in);
        out.flush();
        out.close();

    }
}

import java.util.Scanner;

public class FiveInARow {

    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        char m[][]= new char[10][10];
        for(int i=0;i<10;i++){
            String str=in.next();
            m[i]=str.toCharArray();
        }

        boolean ip=false;
        for(int i=0;i<10 && !ip;i++){
            for(int j=0;j<10 && !ip;j++){
                if(m[i][j]=='X'){
                    if(j<6 && i<6 && !ip){
                        int c=1;
                        boolean ef=false;
                        for(int k=1;k<5;k++){
                            if(m[i+k][j+k]=='O') break;
                            else if(m[i+k][j+k]=='X') c++;
                            else if(m[i+k][j+k]=='.') ef=true;
                        }
                        if(c==4 && ef==true) {ip=true;System.out.println("YES"); break;}
                    }
                    if(j<6 && !ip){
                        int c=1;
                        boolean ef=false;
                        for(int k=j;k<j+5;k++){
                            if(m[i][k]=='O') break;
                            else if(m[i][k]=='X') c++;
                            else if(m[i][k]=='.') ef=true;
                        }
                        if(c==4 && ef==true) {ip=true;System.out.println("YES");break;}
                    }if(i<6 && !ip){
                        int c=1;
                        boolean ef=false;
                        for(int k=i;k<i+5;k++){
                            if(m[k][j]=='O') break;
                            else if(m[k][j]=='X') c++;
                            else if(m[k][j]=='.') ef=true;
                        }
                        if(c==4 && ef==true) {ip=true;System.out.println("YES");break;}
                    }
                }
            }
        }
    }

}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class FiveInARow {

	public static boolean horizontal(char[][] table,int i,int j)
	{
		int limit = Math.min(10, j+5);
		int Xcount=0,dotcount=0;
		for(int k=j;k<limit;k++)
		{
			if(table[i][k]=='X')
				Xcount++;
			else if(table[i][k]=='.')
				dotcount++;
		}
		if(Xcount==4 && dotcount==1)
			return true;
		else
			return false;
	}

	public static boolean vertical(char[][] table,int i,int j)
	{
		int limit = Math.min(10, i+5);
		int Xcount=0,dotcount=0;
		for(int k=i;k<limit;k++)
		{
			if(table[k][j]=='X')
				Xcount++;
			else if(table[k][j]=='.')
				dotcount++;
		}
		if(Xcount==4 && dotcount==1)
			return true;
		else
			return false;
	}

	public static boolean diagonal(char[][] table,int i,int j)
	{
		int Xcount=0,dotcount=0;
		for(int k=0;i+k<Math.min(10, i+5) && j+k<Math.min(10, j+5);k++)
		{
			if(table[i+k][j+k]=='X')
				Xcount++;
			else if(table[i+k][j+k]=='.')
				dotcount++;
		}
		if(Xcount==4 && dotcount==1)
			return true;
		else
			return false;
	}

	public static boolean reverseDiagonal(char[][] table,int i,int j)
	{
		int Xcount=0,dotcount=0;
		for(int k=0;i+k<Math.min(10, i+5) && j-k>Math.max(-1, j-5);k++)
		{
			if(table[i+k][j-k]=='X')
				Xcount++;
			else if(table[i+k][j-k]=='.')
				dotcount++;
		}
		if(Xcount==4 && dotcount==1)
			return true;
		else
			return false;
	}

	public static void main(String[] args) throws NumberFormatException, IOException {
		InputStreamReader in = new InputStreamReader(System.in);
		//FileReader in = new FileReader("Input");
		BufferedReader br = new BufferedReader(in);
		PrintWriter out = new PrintWriter(System.out);
		char[][] table = new char[10][10];
		for(int i=0;i<10;i++)
			table[i] = br.readLine().toCharArray();
		for(int i=0;i<10;i++)
		{
			for(int j=0;j<10;j++)
			{
				if(table[i][j]=='X')
				{
					if(horizontal(table, i, j) || vertical(table, i, j) || diagonal(table, i, j) || reverseDiagonal(table, i, j))
					{
						System.out.print("YES");
						return;
					}
				}
			}
		}
		System.out.println("NO");
		out.close();
		br.close();
	}

	public static void debug(Object...obj) {
        System.err.println(Arrays.deepToString(obj));
    }
}

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+=rc;
                    lduc+=rddc;
                    lddc+=rduc;
                    if(lc>=4||uc>=4||lduc>=4||lddc>=4)f=true;

                }

            }
        }
        w.println(f?"YES":"NO");
        w.close();
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.*;
import java.util.*;

/**
 *
 * @author george150485
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        List<String>A=new ArrayList<String>();
        List<String>C=new ArrayList<String>();
        for (int i = 0; i < 10; ++i) {
            A.add(br.readLine());
        }
        for (int i = 0; i < 10; i++) {
            C.add(A.get(i));
        }
        String help;
        for (int i = 0; i < 10; ++i) {
            help="";
            for (int j = 0; j < 10; ++j) {
                help+=A.get(j).charAt(i);
            }
            C.add(help);
        }
       String one="XXXX.";
       String two=".XXXX";
       String three="XXX.X";
       String four="XX.XX";
       String five="X.XXX";
        for (int i = 0; i < 10; ++i) {
            for (int j = 0; j < 10; ++j) {
                //start row i col j
                help="";
                help+=A.get(i).charAt(j);
                for (int l=j+1, m = i+1; m < 10; ++m,++l) {
                    if(m==10||l==10)
                        break;
                    help+=A.get(m).charAt(l);
                }
                C.add(help);
            }
        }
        for (int i = 0; i < 10; ++i) {
            for (int j = 0; j < 10; ++j) {
                //start row i col j
                help="";
                help+=A.get(i).charAt(j);
                for (int l=j-1, m = i-1; m >-1; --m,--l) {
                    if(m==-1||l==-1)
                        break;
                    help+=A.get(m).charAt(l);
                }
                C.add(help);
            }
        }
        for (int i = 0; i < C.size(); ++i) {
            if(C.get(i).contains(one)||C.get(i).contains(two)||C.get(i).contains(three)||C.get(i).contains(four)||C.get(i).contains(five)){
            System.out.println("YES");System.exit(0);
            }

        }
        System.out.println("NO");
    }

}

import java.util.*;

public class Darshjava
{
    public static void win (char [][] alice , int rowpos , int colpos , int xs  , int point , int direc )
    {
        int rowcpy = 0 , colcpy = 0 ;
        if (direc == 1)
        {
            rowcpy = rowpos-1 ; colcpy = colpos-1 ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy>=0 && colcpy >= 0)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }
        else if (direc == 2)
        {
            rowcpy = rowpos-1 ; colcpy = colpos ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy>=0)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }
        else if (direc == 3)
        {
            rowcpy = rowpos-1 ; colcpy = colpos+1 ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy>=0 && colcpy < 10)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }else if (direc == 4)
        {

            rowcpy = rowpos ; colcpy = colpos+1 ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(colcpy < 10)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                {   xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.'&& point == 0)
                {   point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }
        else if (direc == 5)
        {
            rowcpy = rowpos+1 ; colcpy = colpos+1 ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy < 10 && colcpy < 10)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }
        else if (direc == 6)
        {
            rowcpy = rowpos+1 ; colcpy = colpos ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy < 10)
            {

                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }
        else if (direc == 7)
        {
            rowcpy = rowpos+1 ; colcpy = colpos-1 ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy < 10 && colcpy >=0 )
            {

                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }
        else if (direc == 8)
        {
            rowcpy = rowpos ; colcpy = colpos-1 ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(colcpy >= 0)
            {

                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }

    }

    public static void main(String args [])
    {
        Scanner enter = new Scanner (System.in) ;
        char field[][] = new char [10] [10] ;
        int xs = 0 , point = 0 ;
        for(int i = 0 ; i < 10 ; i++)
        {
            String row = enter.next() ;
            for(int j = 0 ; j < 10 ; j++)
                field [i][j] = row.charAt(j);
        }
        for(int i = 0 ; i < 10 ; i++)
            for(int j = 0 ; j < 10 ; j++)
                if(field[i][j] == 'X')
                    for(int k = 1 ; k < 8 ; k++)
                    {   point = 0 ;
                        if (k == 1 && i+1 < 10 && j+1 < 10 && field[i+1][j+1] == '.')
                            point = 1 ;
                        else if (k == 2 && i+1 < 10 && field[i+1][j] == '.')
                            point = 1 ;
                        else if (k == 3 && i+1 < 10 && j-1 >= 0 && field[i+1][j-1] == '.')
                            point = 1 ;
                        else if (k == 4 && j-1 >= 0 && field[i][j-1] == '.')
                            point = 1 ;
                        else if (k == 5 && i-1 >= 0 && j-1 >= 0 && field[i-1][j-1] == '.')
                            point = 1 ;
                        else if (k == 6 && i-1 >= 0 &&  field[i-1][j] == '.')
                            point = 1 ;
                        else if (k == 7 && i-1 >= 0 && j+1 < 10 && field[i-1][j+1] == '.')
                            point = 1 ;
                        else if (k == 8 && j+1 < 10 && field[i][j+1] == '.')
                            point = 1 ;

                        win(field , i , j , 1 , point , k );
                    }
        System.out.print("NO");
    }
}

    import java.util.Scanner;

    public class FiveInARow {

        public static void main(String[] args) {
            // TODO code application logic here
            Scanner in = new Scanner(System.in);
            char m[][]= new char[10][10];
            for(int i=0;i<10;i++){
                String str=in.next();
                m[i]=str.toCharArray();
            }

            boolean ip=false;
            String output="NO";
            for(int i=0;i<10 && !ip;i++){
                for(int j=0;j<10 && !ip;j++){
                    if(m[i][j]=='X'){
                        if(j<6 && i<6 && !ip){
                            int c=0;
                            int ef=0;
                            for(int k=0;k<5;k++){
                                if(m[i+k][j+k]=='O') break;
                                else if(m[i+k][j+k]=='X') c++;
                                else if(m[i+k][j+k]=='.') ef++;
                            }
                            if(c==4 && ef==1) {ip=true;output="YES"; break;}
                        }
                        if(j<6 && !ip){
                            int c=0;
                            int ef=0;
                            for(int k=j;k<j+5;k++){
                                if(m[i][k]=='O') break;
                                else if(m[i][k]=='X') c++;
                                else if(m[i][k]=='.') ef++;
                            }
                            if(c==4 && ef==1) {ip=true;output="YES";break;}
                        }if(i<6 && !ip){
                            int c=0;
                            int ef=0;
                            for(int k=i;k<i+5;k++){
                                if(m[k][j]=='O') break;
                                else if(m[k][j]=='X') c++;
                                else if(m[k][j]=='.') ef++;
                            }
                            if(c==4 && ef==1) {ip=true;output="YES";break;}
                        }if(j>3 && i<6 && !ip){
                            int c=0;
                            int ef=0;
                            for(int k=0;k<5;k++){
                                if(m[i+k][j-k]=='O') break;
                                else if(m[i+k][j-k]=='X') c++;
                                else if(m[i+k][j-k]=='.') ef++;
                            }
                            if(c==4 && ef==1) {ip=true;output="YES";break;}

                        }
                    }
                }
            }
            System.out.println(output);
        }

    }

import java.util.*;

public class Darshjava
{
    public static void win (char [][] alice , int rowpos , int colpos , int xs  , int point , int direc )
    {
        int rowcpy = 0 , colcpy = 0 ;
        if (direc == 1)
        {
            rowcpy = rowpos-1 ; colcpy = colpos-1 ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy>=0 && colcpy >= 0)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }
        else if (direc == 2)
        {
            rowcpy = rowpos-1 ; colcpy = colpos ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy>=0)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }
        else if (direc == 3)
        {
            rowcpy = rowpos-1 ; colcpy = colpos+1 ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy>=0 && colcpy < 10)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }else if (direc == 4)
        {

            rowcpy = rowpos ; colcpy = colpos+1 ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(colcpy < 10)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                {   xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.'&& point == 0)
                {   point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }
        else if (direc == 5)
        {
            rowcpy = rowpos+1 ; colcpy = colpos+1 ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy < 10 && colcpy < 10)
            {
                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }
        else if (direc == 6)
        {
            rowcpy = rowpos+1 ; colcpy = colpos ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy < 10)
            {

                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }
        else if (direc == 7)
        {
            rowcpy = rowpos+1 ; colcpy = colpos-1 ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(rowcpy < 10 && colcpy >=0 )
            {

                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }
        else if (direc == 8)
        {
            rowcpy = rowpos ; colcpy = colpos-1 ;
            if (xs == 4 && point == 1)
                {System.out.print("YES"); System.exit(0);}
            else if(colcpy >= 0)
            {

                if(alice[rowcpy][colcpy] == 'X' && point < 2 )
                { xs++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
                else if(alice[rowcpy][colcpy] == '.' && point == 0)
                { point++ ; win(alice , rowcpy , colcpy , xs , point , direc) ;}
            }
        }

    }

    public static void main(String args [])
    {
        Scanner enter = new Scanner (System.in) ;
        char field[][] = new char [10] [10] ;
        int xs = 0 , point = 0 ;
        for(int i = 0 ; i < 10 ; i++)
        {
            String row = enter.next() ;
            for(int j = 0 ; j < 10 ; j++)
                field [i][j] = row.charAt(j);
        }
        for(int i = 0 ; i < 10 ; i++)
            for(int j = 0 ; j < 10 ; j++)
                if(field[i][j] == 'X')
                    for(int k = 1 ; k < 8 ; k++)
                    {
                        if (k == 1 && i+1 < 10 && j+1 < 10 && field[i+1][j+1] == '.')
                            point = 1 ;
                        else if (k == 2 && i+1 < 10 && field[i+1][j] == '.')
                            point = 1 ;
                        else if (k == 3 && i+1 < 10 && j-1 >= 0 && field[i+1][j-1] == '.')
                            point = 1 ;
                        else if (k == 4 && j-1 >= 0 && field[i][j-1] == '.')
                            point = 1 ;
                        else if (k == 5 && i-1 >= 0 && j-1 >= 0 && field[i-1][j-1] == '.')
                            point = 1 ;
                        else if (k == 6 && i-1 >= 0 &&  field[i-1][j] == '.')
                            point = 1 ;
                        else if (k == 7 && i-1 >= 0 && j+1 < 10 && field[i-1][j+1] == '.')
                            point = 1 ;
                        else if (k == 8 && j+1 < 10 && field[i][j+1] == '.')
                            point = 1 ;
                        win(field , i , j , 1 , point , k );
                    }
        System.out.print("NO");
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author sys_coder
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            char[][] arr = new char[10][10];
            for (int i = 0; i < 10; i++) {
                arr[i] = in.nextString().toCharArray();
            }
            int dx[] = {0, 1, -1, 1};
            int dy[] = {1, 0, 1, 1};
            for (int i = 0; i < 10; i++) {
                boolean flag = false;
                for (int j = 0; j < 10; j++) {
                    if (arr[i][j] == '.') {
                        arr[i][j] = 'X';
                        for (int k = 0; k < dx.length; k++) {
                            flag = check(i, j, arr, dx[k], dy[k]);
                            if (flag) {
                                out.print("YES");
                                return;
                            }
                        }
                        arr[i][j] = '.';
                    }

                }

            }

            out.print("NO");
        }

        private boolean check(int i, int j, char[][] arr, int xx, int yy) {
            for (int k = 0; k < 5; k++) {
                int count = 0;
                for (int l = -4; l < 5; l++) {
                    if (valid(i + k + l * xx, j + k + l * yy) && arr[i + k + l * xx][j + k + l * yy] == 'X') {
                        count++;
                    }
                }
                if (count == 5) return true;

            }
            return false;
        }

        private boolean valid(int k, int l) {
            if (k < 0 || k > 9 || l < 0 || l > 9) return false;
            return true;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.close();
        }

    }
}

import java.util.Scanner;

public class FiveInRow {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int index = -1;
        String[] matrix = new String[10];
        for (int i = 0; i < 10; i++){
            matrix[i] = sc.nextLine();
            if (index == -1 && matrix[i].contains("X")){
                index = i;
            }
        }
        if (index == -1){
            System.out.println("NO");
        } else {
            if (horizontalCheck(matrix[index]) || verticalCheck(matrix,index) || diagonalCheck(matrix,index)){
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
    public static boolean horizontalCheck(String line){
        if (line.contains(".XXXX") || line.contains("XXXX.") ||
                line.contains("X.XXX") || line.contains("XX.XX") ||
                line.contains("XXX.X")){
            return true;
        }
        return false;
    }
    public static boolean verticalCheck(String[] field, int index) {
        String line = "";
        for (int i = 0; i < 10; i++) {
            line += field[i].charAt(index);
        }
        return horizontalCheck(line);
    }
    public static boolean diagonalCheck(String[] field, int index){
        String line = "";
        int x = field[index].indexOf("X")-1;
        int i = index;
        for (int t = 0; t < index-1; t ++){
            line+=".";
        }
        while (++x<10){
            line+= field[i].charAt(x);
            i++;
        }
        System.out.println(line);
        if (!horizontalCheck(line)){
            line = "";
            for (int t = 0; t < index-1; t ++){
                line+=".";
            }
            i = index;
            x = field[index].indexOf("X")+1;
            while (--x>=0){
                line+= field[i].charAt(x);
                i++;
            }
            return horizontalCheck(line);
        } else {
            return horizontalCheck(line);
        }
    }
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {

	static class Solver {

		private final static int SIZE = 10;

		private static int[] dr = {0,1,1};
		private static int[] dc = {1,0,1};

		public String solve() {
			Scanner in = new Scanner(System.in);

			char str[][] = new char [SIZE][SIZE];
			for (int i=0;i<SIZE;++i) {
				String tmp = in.next();
				for (int j=0;j<SIZE;++j) {
					str[i][j] = tmp.charAt(j);
				}
			}

			if (check(str)) {
				return "YES";
			}

			for (int i=0;i<SIZE;++i) {
				for (int j=0;j<SIZE;++j) {
					char save = str[i][j];
					if (save != '.')continue;
					str[i][j] = 'X';
					if (check(str)) {
						return "YES";
					}
					str[i][j] = save;
				}
			}
			return "NO";
		}

		private boolean check(char [][]str) {

			for (int i=0;i<SIZE;++i) {
				for (int j=0;j<SIZE;++j) {
					for (int d=0;d<3;++d) {
						int k;
						for (k=0;k<5;++k) {
							int r = i + k*dr[d];
							int c = j + k*dc[d];
							//System.out.println(r+" "+c+" "+str[r][c]+" "+dr[d]+" "+dc[d]);
							if (!valid(r,c) || str[r][c] != 'X') {
								break;
							}
						}
						if (k == 5){
							return true;
						}
					}
				}
			}

			return false;
		}

		private boolean valid(int r,int c) {
			return r>=0 && r<SIZE && c>=0 && c<SIZE;
		}
	}

	public static void main(String []args) {
		System.out.println(new Solver().solve());
	}
}

import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
	static final Scanner s=new Scanner(System.in);
	static IntStream REPS(int v){
		return IntStream.range(0,v);
	}
	static IntStream REPS(int l,int r){
		return IntStream.rangeClosed(l,r);
	}
	static IntStream INS(int n){
		return REPS(n).map(i->getInt());
	}
	static int getInt(){
		return Integer.parseInt(s.next());
	}

	static char[][] f=REPS(10).mapToObj(i->s.next().toCharArray()).toArray(char[][]::new);
	public static void main(String[]$){
		for(int i=0;i<10;i++)
			for(int j=0;j<10;j++)
				if(solve(i,j)){
					System.out.println("YES");
					return;
				}
		System.out.println("NO");
	}
	static char O='O',X='X';
	private static boolean solve(int i,int j){
		if(f[i][j]!='.') return false;

		// |
		int c=0;
		for(int p=1;p<=4;++p){
			if(izryt(i-p,j)){
				if(f[i-p][j]==O)
					++c;
			}else
				break;
		}
		for(int p=1;p<=4;++p){
			if(izryt(i+p,j)){
				if(f[i+p][j]==O)
					++c;
			}else
				break;
		}
		if(c>=4) return true;

		// -
		c=0;
		for(int p=1;p<=4;++p){
			if(izryt(i,j-p)){
				if(f[i][j-p]==O)
					++c;
			}else
				break;
		}
		for(int p=1;p<=4;++p){
			if(izryt(i,j+p)){
				if(f[i][j+p]==O)
					++c;
			}else
				break;
		}
		if(c>=4) return true;

		// \(backslash)
		c=0;
		for(int p=1;p<=4;++p){
			if(izryt(i-p,j-p)){
				if(f[i-p][j-p]==O)
					++c;
			}else
				break;
		}
		for(int p=1;p<=4;++p){
			if(izryt(i+p,j+p)){
				if(f[i+p][j+p]==O)
					++c;
			}else
				break;
		}
		if(c>=4) return true;

		// \(backslash)
		c=0;
		for(int p=1;p<=4;++p){
			if(izryt(i+p,j-p)){
				if(f[i+p][j-p]==O)
					++c;
			}else
				break;
		}
		for(int p=1;p<=4;++p){
			if(izryt(i-p,j+p)){
				if(f[i-p][j+p]==O)
					++c;
			}else
				break;
		}
		if(c>=4) return true;

		return false;
	}

	private static boolean izryt(int y,int x){
		return 0<=y&&y<10&&0<=x&&x<10&&f[y][x]!=X;
	}
}

import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        //New Game.
        Five_In_a_Row newGame = new Five_In_a_Row();
        //Getting Grid.
        newGame.loadGrid();
        //result.
        if(newGame.finalVerdict())
            System.out.println("YES");
        else System.out.println("NO");
    }
    //For console input.
    public static Scanner read = new Scanner(System.in);
}
class Five_In_a_Row{
    //Function to Present Final Verdict.
    public boolean finalVerdict(){
        boolean [] allVerdicts = new boolean[4];
        //Collecting all Veridicts.
        allVerdicts[0] = checkAllHorizontalSegments();
        allVerdicts[1] = checkAllVerticalSegments();
        allVerdicts[2] = checkAllPrimarySegments();
        allVerdicts[3] = checkAllSecondrySegments();
        //final Verdict.
        return allVerdicts[0]||allVerdicts[1]||
            allVerdicts[2]||allVerdicts[3];
    }
    //Function to Check all primary diagonal Segemnts.
    public boolean checkAllPrimarySegments(){
        boolean found = false,contiueSearch = true;
        for (int i = 0;i<=segLength && !found;++i){
            for (int j = 0;j<=segLength && contiueSearch;++j){
                contiueSearch = !helpPrimary(i,j);
            }
            if(!contiueSearch)
                found = !found;
        }
        return found;
    }
    //Function to Check all secondry diagonal Segemnts.
    public boolean checkAllSecondrySegments(){
        boolean found = false,contiueSearch = true;
        for (int i = 0;i<=segLength && !found;++i){
            for (int j = segLength-1;j<grid.length && contiueSearch;++j){
                contiueSearch = !helpSecondry(i,j);
            }
            if(!contiueSearch)
                found = !found;
        }
        return found;
    }
    //Function to Check all horizontal Segments.
    public boolean checkAllHorizontalSegments(){
        boolean found = false,contiueSearch = true;
        for (int i = 0;i<grid.length && !found;++i){
            for (int j = 0;j<segLength && contiueSearch;++j){
                contiueSearch = !helpHorizontal(i,j);
            }
            if(!contiueSearch)
                found = !found;
        }
        return found;
    }
    //Function to Check all vertical Segments.
    public boolean checkAllVerticalSegments(){
        boolean found = false,contiueSearch = true;
        for (int i = 0;i<grid.length && !found;++i){
            for (int j = 0;j<segLength && contiueSearch;++j){
                contiueSearch = !helpVertical(i,j);
            }
            if(!contiueSearch)
                found = !found;
        }
        return found;
    }
    //Function to Check a primary diagonal Segemnt.
    public boolean helpPrimary(int rowX,int colX){
        int crossCount = 0,dotCount = 0;
        for (int x=0;x<=segLength-1;++x){
            if(this.grid[x+rowX][x+colX] == 'X')
                ++crossCount;
            else if (this.grid[x+rowX][x+colX] == '.')
                ++dotCount;
        }
        return crossCount == 4 && dotCount == 1;
    }
    //Function to Check a secondry diagonal Segemnt.
    public boolean helpSecondry(int rowX,int colX){
        int crossCount = 0,dotCount = 0;
        for (int x=0;x<=segLength-1;++x){
            if(this.grid[x+rowX][colX-x] == 'X')
                ++crossCount;
            else if (this.grid[x+rowX][colX-x] == '.')
                ++dotCount;
        }
        return crossCount == 4 && dotCount == 1;
    }
    //Function to Check a horizontal Segment.

    public boolean helpHorizontal(int rowX,int startX){
        int crossCount = 0,dotCount = 0;
        for (int x=startX;x<=startX+segLength-1;++x){
            if(this.grid[rowX][x] == 'X')
                ++crossCount;
            else if (this.grid[rowX][x] == '.')
                ++dotCount;
        }
        return crossCount == 4 && dotCount == 1;
    }
    //Function to Check a vertical Segment.
    public boolean helpVertical(int colX,int startX){
        int crossCount = 0,dotCount = 0;
        for (int x=startX;x<=startX+segLength-1;++x){
            if(this.grid[x][colX] == 'X')
                ++crossCount;
            else if (this.grid[x][colX] == '.')
                ++dotCount;
        }
        return crossCount == 4 && dotCount == 1;
    }
    //Function to get Grid from Codeforces.
    public void loadGrid(){
        String inpStr = "";
        for (int i = 0;i<grid.length;++i){
            inpStr = Main.read.next();
            for (int j = 0;j<inpStr.length();++j){
              this.grid[i][j] =  inpStr.charAt(j);
            }
        }
    }
    //For Storing Game.
    private char [][] grid = new char [10][10];
    private int segLength = 5;
}

import java.util.Scanner;

public class fiveinarow {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		winner();

	}
	public static void winner()
	{
		Scanner sc=new Scanner(System.in);
		String[] str=new String[10];
		char[][]ch=new char[10][10];
		for(int i=0;i<10;i++)
		{
			str[i]=sc.nextLine();
		}
		for(int i=0;i<10;i++)
		{
			for(int j=0;j<10;j++)
			{
				ch[i][j]=str[i].charAt(j);
			}
		}
		int flag=0;
		int count1=0;
		int count2=0;
		int count3=0;
		int count4=0;
		for(int i=0;i<=9&&flag==0;i++)
		{
			for(int j=0;j<=5&&flag==0;j++)
			{
				count1=0;
				for(int k=j;k<=j+4;k++)
				{
					if(ch[i][k]=='X')
						count1++;
					else if(ch[i][k]=='O')
						count1=0;
					else
						count1=count1;
				}
				if(count1==4)
					flag=1;
			}
		}
		for(int i=0;i<=5&&flag==0;i++)
		{
			for(int j=0;j<=9&&flag==0;j++)
			{
				count2=0;
				for(int k=i;k<=i+4;k++)
				{
					if(ch[k][j]=='X')
						count2++;
					else if(ch[k][j]=='O')
						count2=0;
					else
						count2=count2;
				}
				if(count2==4)
					flag=1;
			}
		}
		for(int i=0;i<=5&&flag==0;i++)
		{
			for(int j=0;j<=5&&flag==0;j++)
			{
				count3=0;
				int jth=j;
				int ith=i;
				for(int k=1;k<=5;k++,ith++,jth++)
				{
					if(ch[ith][jth]=='X')
						count3++;
					else if(ch[ith][jth]=='O')
						count3=0;
					else
					{
						count3=count3;
					}
				}
				if(count3==4)
					flag=1;
			}
		}
		for(int i=0;i>=5&&flag==0;i++)
		{
			for(int j=9;j>=4&&flag==0;j--)
			{
				count4=0;
				int ith=i;
				int jth=j;
				for(int k=1;k<=5;k++,ith++,jth--)
				{
					if(ch[ith][jth]=='X')
						count4++;
					else if(ch[ith][jth]=='O')
						count4=0;
					else
						count4=count4;
				}
				if(count4==4)
					flag=1;
			}
		}
		if(flag==1)
			System.out.println("YES");
		else
			System.out.println("NO");
	}

}

import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;

public class tr0 {
	static PrintWriter out;
	static StringBuilder sb;
	static int mod = 1000000007;
	static int inf = (int) 1e16;
	static ArrayList<Integer>[] ad;
	static int n, m;
	static long[][] memo, c;
	static HashSet<Integer> h;
	static int[] ans;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		char[][] g = new char[10][10];
		for (int i = 0; i < 10; i++)
			g[i] = sc.nextLine().toCharArray();
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				if (g[i][j] != '.')
					continue;
				int co = 1;
				for (int ii = i + 1; ii < 10; ii++)
					if (g[ii][j] != 'X')
						break;
					else
						co++;
				for (int ii = i - 1; ii >= 0; ii--)
					if (g[ii][j] != 'X')
						break;
					else
						co++;
				if (co >= 5) {
					System.out.println("YES");
					return;
				}
				co = 1;
				for (int ii = j + 1; ii < 10; ii++)
					if (g[i][ii] != 'X')
						break;
					else
						co++;
				for (int ii = j - 1; ii >= 0; ii--)
					if (g[i][ii] != 'X')
						break;
					else
						co++;
				if (co >= 5) {
					System.out.println("YES");
					return;
				}
				co = 1;
				for (int ii = i + 1, jj = j + 1; ii < 10 && jj < 10; ii++, jj++)
					if (g[ii][jj] != 'X')
						break;
					else
						co++;
				for (int ii = i - 1, jj = j - 1; ii >= 0 && jj >= 0; ii--, jj--)
					if (g[ii][jj] != 'X')
						break;
					else
						co++;

				if (co >= 5) {
					System.out.println("YES");
					return;
				}

				co = 1;
				for (int ii = i + 1, jj = j - 1; ii < 10 && jj >= 0; ii++, jj--)
					if (g[ii][jj] != 'X')
						break;
					else
						co++;
				for (int ii = i + 1, jj = j - 1; ii <10 && jj >= 0; ii++, jj--)
					if (g[ii][jj] != 'X')
						break;
					else
						co++;

				if (co >= 5) {
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
		out.close();
	}

	static class pair implements Comparable<pair> {
		int to;
		int number;

		pair(int t, int n) {
			number = n;
			to = t;
		}

		public String toString() {
			return to + " " + number;
		}

		@Override
		public int compareTo(pair o) {
			if (number == o.number)
				return o.to - to;
			return o.number - number;
		}

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

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

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

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

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

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

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

		public int[] nextArrInt(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextArrLong(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class FiveInARow implements Closeable {

    private InputReader in = new InputReader(System.in);
    private PrintWriter out = new PrintWriter(System.out);

    public void solve() {
        char[][] x = new char[10][10];
        for (int i = 0; i < 10; i++) {
            x[i] = in.next().toCharArray();
        }
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                if (x[i][j] == '.') {
                    x[i][j] = 'X';
                    if (ok(x)) {
                        out.println("YES");
                        return;
                    }
                    x[i][j] = '.';
                }
            }
        }
        out.println("NO");
    }

    private boolean ok(char[][] x) {
        for (int i = 0; i < 5; i++) {
            for (int j = 0; j < 5; j++) {
                if (row(x, i, j) || col(x, i, j) || diag(x, i, j)) {
                    return true;
                }
            }
        }
        return false;
    }

    private boolean row(char[][] x, int i, int j) {
        for (int k = 0; k < 5; k++) {
            if (x[i + k][j] != 'X') return false;
        }
        return true;
    }

    private boolean col(char[][] x, int i, int j) {
        for (int k = 0; k < 5; k++) {
            if (x[i][j + k] != 'X') return false;
        }
        return true;
    }

    private boolean diag(char[][] x, int i, int j) {
        for (int k = 0; k < 5; k++) {
            if (x[i + k][j + k] != 'X') return false;
        }
        return true;
    }
    @Override
    public void close() throws IOException {
        in.close();
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public 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 ni() {
            return Integer.parseInt(next());
        }

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

        public void close() throws IOException {
            reader.close();
        }
    }

    public static void main(String[] args) throws IOException {
        try (FiveInARow instance = new FiveInARow()) {
            instance.solve();
        }
    }
}

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String matrix[] = new String[10];
		for (int i = 0; i < 10; i++) {
			matrix[i] = sc.nextLine();

		}

		System.out.println(process(matrix) ? "YES" : "NO") ;

		sc.close();
	}

	private static boolean process(String[] matrix) {
		for (int i = 0; i < 10; i++) {

			//busca horizontal
			int idx = matrix[i].indexOf("X");

			int aux = idx;
			boolean vert = false;
			while (idx != -1) {

				if (idx > 0) {
					if (matrix[i].charAt(idx-1) == '.') {
						idx--;
					}
				}
				if(busca(matrix[i], idx))
					return true;

				if (i > 0) {
					if (matrix[i-1].charAt(idx) == '.') {
						i--;
						vert = true;
					}
				}
				String str = stringVertical(matrix, i, aux);
				//aux = str.indexOf("X");
				if(busca(str, 0))
					return true;
				if (vert) i++;
				vert = false;

				str = stringDiagonalDireita(matrix, i, aux);
				//aux = str.indexOf("X");
				if(busca(str, 0))
					return true;

				str = stringDiagonalEsquerda(matrix, i, aux);
				//aux = str.indexOf("X");
				if(busca(str, 0))
					return true;

				idx = matrix[i].indexOf("X", aux+1);
				aux = idx;
			}

		}

		return false;
	}

	private static String stringDiagonalEsquerda(String[] matrix, int i, int idx) {
		StringBuilder str = new StringBuilder();

		if ((i > 0) && (idx < 9)) {
			char c = matrix[i-1].charAt(idx+1);
			if (c == '.') {
				str.append(c);
			}

			str.append(c);
		}

		for (int j = i; j < 10; j++) {
			if(idx >= 0)
				str.append(matrix[j].charAt(idx--));
			else break;
		}

		return str.toString();
	}

	private static String stringDiagonalDireita(String[] matrix, int i, int idx) {
		StringBuilder str = new StringBuilder();

		if ((i > 0) && (idx > 0)) {
			char c = matrix[i-1].charAt(idx-1);
			if (c == '.') {
				str.append(c);
			}

		}
		for (int j = i; j < 10; j++) {
			if (idx < 10) {
				str.append(matrix[j].charAt(idx++));
			} else break;
		}

		return str.toString();
	}

	private static String stringVertical(String[] matrix, int i, int idx) {
		StringBuilder str = new StringBuilder();
		for (int j = i; j < 10; j++) {
			str.append(matrix[j].charAt(idx));
		}
		return str.toString();
	}

	private static boolean busca(String matrix, int idx) {
		boolean usedDot = false;
		int size = 1;

		if ((idx == -1) || (matrix.length() < 5)){
			return false;
		}

		for (int k = idx+1; k < 10; k++) {
			if (matrix.charAt(k) == 'O') {
				break;
			} else if (matrix.charAt(k) == '.') {
				if (!usedDot)
					usedDot = true;
				else break;
			}
			size++;

			if (size == 5) return true;
		}

		return false;
	}

}

import java.lang.reflect.Array;
import java.util.*;
import java.io.*;

public class Main {
    static int n=10,m=10;
    static char[][]s;
    static boolean check(){
        boolean ans=false;
        for (int i =0;i<n;i++){
            for (int j =0;j<m;j++){
                if (s[i][j]=='X'){
                    ans|=getrow(i,j);
                    ans|=getcol(i,j);
                    ans|=getdiag(i,j);
                }
            }
        }
        return ans;
    }
    static boolean getrow(int i,int j){
        int cur=0;
        while (j<m&&s[i][j]=='X'){
            cur++;
            j++;
        }
        return cur>=5;
    }
    static boolean getcol(int i,int j){
        int cur=0;
        while (i<n&&s[i][j]=='X'){
            cur++;
            i++;
        }
        return cur>=5;
    }
    static boolean getdiag(int i,int j){
        int cur=0;
        int i2=i;
        int j2=j;
        int cur2=0;
        while (j<m&&i<n&&s[i][j]=='X'){
            cur++;
            j++;
            i++;
        }
        i=i2;
        j=j2;
        while (j>=0&&i>=0&&s[i][j]=='X'){
            cur2++;
            j--;
            i--;
        }
        return cur>=5||cur2>=5;
    }
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        s= new char[10][10];
        for (int i =0;i<n;i++)
            s[i]=sc.next().toCharArray();
        boolean ans=false;
        for (int i =0;i<n;i++){
            for (int j =0;j<m;j++){
                if(s[i][j]=='.'){
                    s[i][j]='X';
                    ans|=check();
                    s[i][j]='.';
                }
            }
        }
        pw.println(ans?"YES":"NO");
        pw.close();

    }

    static class Scanner {
        BufferedReader br;
        StringTokenizer st;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

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

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

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

        public int[] nextIntArr(int n) throws IOException {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = Integer.parseInt(next());
            }
            return arr;
        }

    }

}

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);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{
	public static void main(String args[]){
		InputReader scan = new InputReader();
		char[][] c = new char[10][10];
		for(int i = 0; i < 10; i++){
			String str = scan.next();
			for(int j = 0; j < str.length(); j++)
				c[i][j] = str.charAt(j);
		}
		if(checkHorizontal(c) || checkVertical(c) || checkDiagonal1(c) || checkDiagonal2(c))
			System.out.println("YES");
		else
			System.out.println("NO");
	}

	static boolean checkHorizontal(char[][] c){
		int counter = 0, counterFromFree = 0;
		boolean free = false;
		for(int i = 0; i < 10; i++){
			for(int j = 0; j < 10; j++){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						counterFromFree = 0;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
		}
		return false;
	}

	static boolean checkVertical(char[][] c){
		int counter = 0, counterFromFree = 0;
		boolean free = false;
		for(int j = 0; j < 10; j++){
			for(int i = 0; i < 10; i++){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						counterFromFree = 0;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
		}
		return false;
	}

	static boolean checkDiagonal1(char[][] c){
		int counter = 0, counterFromFree = 0;
		boolean free = false;
		for(int k = 0; k < 10; k++){
			for(int j = 0, i = k; j < 10 && i < 10; j++, i++){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						counterFromFree = 0;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
			counter = 0;
			counterFromFree = 0;
			for(int i = 0, j = k; i < 10 && j < 10; j++, i++){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						counterFromFree = 0;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
		}
		return false;
	}

	static boolean checkDiagonal2(char[][] c){
		int counter = 0, counterFromFree = 0;
		boolean free = false;
		for(int k = 0; k < 10; k++){
			for(int j = 0, i = k; j < 10 && i >= 0; j++, i--){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						counterFromFree = 0;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
			counter = 0;
			counterFromFree = 0;
			for(int j = k, i = 0; i < 10 && j >= 0; i++, j--){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						counterFromFree = 0;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
		}
		return false;
	}

	//Custom Scanner

	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader() {
            reader = new BufferedReader(new InputStreamReader(System.in));
            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());
        }

    }

}

import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class q5 {

	public static void main(String[] args) throws IOException {

		Reader.init(System.in);
		PrintWriter out=new PrintWriter(System.out);
		StringBuffer output=new StringBuffer("");
		char[][] grid=new char[10][10];
		for(int i=0;i<10;i++) {
			grid[i]=Reader.next().toCharArray();
		}
		String ans="NO";
		for(int i=0;i<10;i++) {
			for(int j=0;j<10;j++) {
				if(grid[i][j]=='.') {
					int above=0,left=0,lud=0,rud=0;
					for(int k=j-1;k>=0;k--) {
						if(grid[i][k]=='O') left++;
						else break;
					}
					for(int k=j+1;k<10;k++) {
					if(grid[i][k]=='O') left++;
					else break;
					}
					for(int k=i-1;k>=0;k--) {
						if(grid[k][j]=='O') {
							above++;
						}
						else break;
					}
					for(int k=i+1;k<10;k++) {
						if(grid[k][j]=='O') {
							above++;
						}
						else break;
					}
					for(int k=i-1,l=j-1;k>=0 && l>=0;k--,l--) {
						if(grid[k][l]=='O') {
							lud++;
						}
						else break;
					}
					for(int k=i+1,l=j+1;k<10 && l<10;k++,l++) {
						if(grid[k][l]=='O') {
							lud++;
						}
						else break;
					}

					for(int k=i-1,l=j+1;k>=0 && l<10;k--,l++) {
						if(grid[k][l]=='O') {
							rud++;
						}
						else break;
					}
					for(int k=i+1,l=j-1;k<10 && l>=0;k++,l--) {
						if(grid[k][l]=='O') {
							rud++;
						}
						else break;
					}
					if(above>=4 || left>=4 || lud>=4 || rud>=4) ans="YES";

				}
			}
		}
		out.print(ans);
		out.flush();
	}
}

class NoD{
	int a, b;
	NoD(int aa,int bb){
		a=Math.min(aa, bb);b=Math.max(aa, bb);
	}
}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
    /** get next word */
    static String nextLine() throws IOException{
    	return reader.readLine();
    }
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }
    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}

import java.io.*;
import java.util.StringTokenizer;

/**
 *
 * @author Altynbek
 */
public class B {

    Scanner in;
    PrintWriter out;

    boolean check(char[] t) {
        int x = 0, p = 0;
        for (int i = 0; i < t.length; i++) {
            if (t[i] == 'X') {
                x++;
            } else if (t[i] == '.') {
                p++;
            }
        }
        return x == 4 && p == 1;
    }

    public void solve() throws Exception {
        char[][] f = new char[10][10];
        for (int i = 0; i < 10; i++) {
            f[i] = in.next().toCharArray();
        }
        boolean canWin = false;
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                String temp = "";
                for (int k = 0; k < 5 && j + k < 10; k++) {
                    temp += f[i][j + k];
                }
                if (check(temp.toCharArray())) {
                    canWin = true;
                }

                temp = "";
                for (int k = 0; k < 5 && i + k < 10 && j + k < 10; k++) {
                    temp += f[i + k][j + k];
                }
                if (check(temp.toCharArray())) {
                    canWin = true;
                }

                temp = "";
                for (int k = 0; k < 5 && i + k < 10; k++) {
                    temp += f[i + k][j];
                }
                if (check(temp.toCharArray())) {
                    canWin = true;
                }

                temp = "";
                for (int k = 0; k < 5 && i + 5 < 10 && j - k >= 0; k++) {
                    temp += f[i + k][j - k];
                }
                if (check(temp.toCharArray())) {
                    canWin = true;
                }
            }
        }

        out.println(canWin ? "YES" : "NO");
    }

    public void init() throws Exception {
        in = new Scanner(System.in);
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new B().init();
    }

    public class Scanner {

        private BufferedReader br;
        private StringTokenizer st;

        public Scanner(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String next() throws Exception {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

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

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

        public Double nextDouble() throws Exception {
            return Double.parseDouble(next());
        }
    }
}

import java.util.Scanner;

public class b825 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn = new Scanner(System.in);
		char[][] arr = new char[10][10];
		for (int i = 0; i < 10; i++) {
			String s=scn.next();
			for (int j = 0; j < 10; j++) {
				arr[i][j] = s.charAt(j);
			}
		}

		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				if(check(i, j, arr))
				{
					return;
				}
			}
		}

		System.out.println("NO");

	}

	public static boolean check(int row, int col, char[][] arr) {
		int xcount = 0;
		int dotcount = 0;

		for (int i = row; i < row + 5 && i < 10; i++) {

			if (arr[i][col] == 'X') {
				xcount++;
			} else if (arr[i][col] == '.') {
				dotcount++;
			}

		}
		if (xcount == 4 && dotcount == 1) {
			System.out.println("YES");
			return true;
		}

		xcount = 0;
		dotcount = 0;
		for (int i = col; i < col + 5 && i < 10; i++) {

			if (arr[i][col] == 'X') {
				xcount++;
			} else if (arr[i][col] == '.') {
				dotcount++;
			}

		}
		if (xcount == 4 && dotcount == 1) {
			System.out.println("YES");
			return true;
		}
		xcount = 0;
		dotcount = 0;

		for (int i = row, j = col; i < row + 5 && j < col + 5 && i < 10 && j < 10; i++, j++) {

			if (arr[i][j] == 'X') {
				xcount++;
			} else if (arr[i][j] == '.') {
				dotcount++;
			}

		}
		if (xcount == 4 && dotcount == 1) {
			System.out.println("YES");
			return true;
		}
		return false;

	}

}

import java.util.*;
public class fiverow
{
   static char[][] board;
    public static void main(String[] args)
    {

        board= new char[10][10];
        Scanner s= new Scanner(System.in);
        boolean done=false;
        for (int i=0; i<10; i++)
        {
            String temp=s.next();
            for (int j=0; j<10; j++)
            {
                board[i][j]=temp.charAt(j);
            }
        }

         for (int i=0; i<10; i++)
        {
            for (int j=0; j<10; j++)
            {
               if (board[i][j]=='X')
               {
                  if (traverse(i,j,-1,0)||traverse(i,j,1,0)||traverse(i,j,0,-1)||traverse(i,j,0,1)||traverse(i,j,-1,-1)||traverse(i,j,1,-1)||traverse(i,j,1,1)||traverse(i,j,-1,1))
                  {
                      System.out.println("YES");
                      done=true;
                      break;
                   }
                }
            }
        }
        if (!done) System.out.println("NO");
    }

    public static boolean traverse(int x, int y,int dx, int dy)
    {
        int count=0; boolean empty=false;
        while (x>=0&&x<10&&y>=0&&y<10)
        {
            if ( x+dx>=0 && y+dy>=0 &&board[x+dx][y+dy]=='X') count++;
            else if ( x+dx>=0 && y+dy>=0 && board[x+dx][y+dy]=='.'&& !empty) {count++; empty=true;}
            else break;

            x+=dx; y+=dy;
        }
        if (count==4) return true;
        return false;
    }

}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class template
{
	static char grid[][];
	static int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
	static int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};
	public static void main(String[] args)
	{
		FastScanner in = new FastScanner();
		int n = 10;
		grid = new char[n][n];

		for(int i = 0; i < n; i++)
			grid[i] = in.next().toCharArray();

		boolean good = false;
		loops: for(int i = 0; i < 10; i++)
		{
			for(int j = 0; j < 10; j++)
			{
				if(grid[i][j] == 'X')
				for(int k = 0; k < dx.length; k++)
				{
					if(cnt(i, j, k, 0) >= 5)
					{
						good = true;
						break loops;
					}
				}
			}
		}

		if(good)
			System.out.println("YES");
		else
			System.out.println("NO");
	}

	private static int cnt(int i, int j, int k, int flag)
	{
		int cnt = 1;
		int nextX = i + dx[k];
		int nextY = j + dy[k];
		if(!inBounds(nextX, nextY)) return cnt;
		if(grid[nextX][nextY] == '.' && flag == 1) return cnt;
		if(grid[nextX][nextY] == 'O') return cnt;

		cnt += cnt(nextX, nextY, k, grid[nextX][nextY] == '.' ? 1 : 0);

		return cnt;
	}

	private static boolean inBounds(int i, int j)
	{
		return i >= 0 && i < 10 && j >= 0 && j < 10;
	}

	public static class FastScanner
	{
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s)
		{
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public FastScanner()
		{
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken()
		{
			while (st == null || !st.hasMoreElements())
			{
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		String next()
		{
			return nextToken();
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class SolutionB {

    public static void main(String[] args) throws IOException {
        Reader reader = new Reader();
        char[][] matrix = new char[10][10];
        for (int i = 0; i < 10; i++) {
            String row = reader.readStringValue();
            for (int j = 0; j < row.length(); j++) {
                matrix[i][j] = row.charAt(j);
            }
        }

        boolean doCrossesWin = findHorizontalPos(matrix) || findVerticalPos(matrix)
                || findDiagonalLeftToRight1(matrix) || findDiagonalLeftToRight2(matrix)
                || findDiagonalRightToLeft1(matrix) || findDiagonalRightToLeft2(matrix);

        if (doCrossesWin) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }

    private static boolean findHorizontalPos(char[][] matrix) {
        for (int i = 0; i < 10; i++) {
            int currHorizontalSequence = 0;
            boolean isReplacementMade = false;
            for (int j = 0; j < 10; j++) {
                if (matrix[i][j] == 'X') {
                    currHorizontalSequence++;
                } else if (matrix[i][j] == 'O') {
                    currHorizontalSequence = 0;
                    isReplacementMade = false;
                } else if (matrix[i][j] == '.' && !isReplacementMade) {
                    isReplacementMade = true;
                    currHorizontalSequence++;
                } else if (matrix[i][j] == '.' && isReplacementMade) {
                    currHorizontalSequence = 0;
                    j--;
                    while (j >= 0 && matrix[i][j] == 'X') {
                        j--;
                    }
                    isReplacementMade = false;
                }

                if (currHorizontalSequence == 5) {
                    return true;
                }
            }
        }
        return false;
    }

    private static boolean findVerticalPos(char[][] matrix) {
        for (int i = 0; i < 10; i++) {
            int currVerticalSequence = 0;
            boolean isReplacementMade = false;
            for (int j = 0; j < 10; j++) {
                if (matrix[j][i] == 'X') {
                    currVerticalSequence++;
                } else if (matrix[j][i] == 'O') {
                    currVerticalSequence = 0;
                    isReplacementMade = false;
                } else if (matrix[j][i] == '.' && !isReplacementMade) {
                    currVerticalSequence++;
                    isReplacementMade = true;
                } else if (matrix[j][i] == '.' && isReplacementMade) {
                    currVerticalSequence = 0;
                    j--;
                    while (j >= 0 && matrix[j][i] == 'X') {
                        j--;
                    }
                    isReplacementMade = false;
                }
                if (currVerticalSequence == 5) {
                    return true;
                }

            }
        }
        return false;
    }

    private static boolean findDiagonalLeftToRight1(char[][] matrix) {
        int currDiagonalSequence = 0;
        boolean isReplacementMade = false;
        for (int k = 0; k < 10; k++) {
            for (int i = 0; i < 10 - k; i++) {
                if (matrix[i + k][i] == 'X') {
                    currDiagonalSequence++;
                } else if (matrix[i + k][i] == 'O') {
                    currDiagonalSequence = 0;
                    isReplacementMade = false;
                } else if (matrix[i + k][i] == '.' && !isReplacementMade) {
                    currDiagonalSequence++;
                    isReplacementMade = true;
                } else if(matrix[i + k][i] == '.' && isReplacementMade) {
                    currDiagonalSequence = 0;
                    i--;
                    while (i >= 0 && matrix[i + k][i] == 'X') {
                        i--;
                    }
                    isReplacementMade = false;
                }

                if(currDiagonalSequence == 5) {
                    return true;
                }
            }
        }

        return false;
    }

    private static boolean findDiagonalLeftToRight2(char[][] matrix) {
        int currDiagonalSequence = 0;
        boolean isReplacementMade = false;
        for (int k = 0; k < 10; k++) {
            for (int i = 0; i < 10 - k; i++) {
                if (matrix[i][i + k] == 'X') {
                    currDiagonalSequence++;
                } else if (matrix[i][i + k] == 'O') {
                    currDiagonalSequence = 0;
                    isReplacementMade = false;
                } else if (matrix[i][i + k] == '.' && !isReplacementMade) {
                    currDiagonalSequence++;
                    isReplacementMade = true;
                } else if(matrix[i][i + k] == '.' && isReplacementMade) {
                    currDiagonalSequence = 0;
                    i--;
                    while (i >= 0 && matrix[i][i + k] == 'X') {
                        i--;
                    }
                    isReplacementMade = false;
                }

                if(currDiagonalSequence == 5) {
                    return true;
                }
            }
        }

        return false;
    }

    private static boolean findDiagonalRightToLeft1(char[][] matrix) {
        int currDiagonalSequence = 0;
        boolean isReplacementMade = false;
        for (int k = 9; k >= 0; k--) {
            for (int i = 0; i <= k; i++) {
                if (matrix[k - i][i] == 'X') {
                    currDiagonalSequence++;
                } else if (matrix[k - i][i] == 'O') {
                    currDiagonalSequence = 0;
                    isReplacementMade = false;
                } else if (matrix[k - i][i] == '.' && !isReplacementMade) {
                    currDiagonalSequence++;
                    isReplacementMade = true;
                } else if(matrix[k - i][i] == '.' && isReplacementMade) {
                    currDiagonalSequence = 0;
                    i++;
                    while (i <= k && matrix[k - i][i] == 'X') {
                        i++;
                    }
                    isReplacementMade = false;
                }

                if(currDiagonalSequence == 5) {
                    return true;
                }
            }
        }

        return false;
    }

    private static boolean findDiagonalRightToLeft2(char[][] matrix) {
        int currDiagonalSequence = 0;
        boolean isReplacementMade = false;
        for (int k = 9; k >= 0; k--) {
            for (int i = 0; i <= k; i++) {
                if (matrix[i][k - i] == 'X') {
                    currDiagonalSequence++;
                } else if (matrix[i][k - i] == 'O') {
                    currDiagonalSequence = 0;
                    isReplacementMade = false;
                } else if (matrix[i][k - i] == '.' && !isReplacementMade) {
                    currDiagonalSequence++;
                    isReplacementMade = true;
                } else if(matrix[i][k - i] == '.' && isReplacementMade) {
                    currDiagonalSequence = 0;
                    i++;
                    while (i <= k && matrix[i][k - i] == 'X') {
                        i++;
                    }
                    isReplacementMade = false;
                }

                if(currDiagonalSequence == 5) {
                    return true;
                }
            }
        }

        return false;
    }

}

class Reader {

    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));

    public StringTokenizer getStringTokenizer() throws IOException {
        String line = bufferedReader.readLine().replaceAll("\\s+$", "");
        return new StringTokenizer(line, " ");
    }

    public int getNextInt(StringTokenizer stringTokenizer) {
        while (stringTokenizer.hasMoreTokens()) {
            return Integer.parseInt(stringTokenizer.nextToken());
        }
        throw new RuntimeException("no more tokens in string");
    }

    public long getNextLong(StringTokenizer stringTokenizer) {
        while (stringTokenizer.hasMoreTokens()) {
            return Long.parseLong(stringTokenizer.nextToken());
        }
        throw new RuntimeException("no more tokens in string");
    }

    public String getNextString(StringTokenizer stringTokenizer) {
        while (stringTokenizer.hasMoreTokens()) {
            return stringTokenizer.nextToken();
        }
        throw new RuntimeException("no more tokens in string");
    }

    public String readStringValue() throws IOException {
        return bufferedReader.readLine().replaceAll("\\s+$", "");
    }

    public int readIntValue() throws IOException {
        String line = bufferedReader.readLine().replaceAll("\\s+$", "");
        int parsedToInt = Integer.parseInt(line);
        return parsedToInt;
    }

    public int[] readIntNumbers() throws IOException {
        String[] line = bufferedReader.readLine().replaceAll("\\s+$", "").split(" ");
        int[] parsedToInt = Arrays.stream(line).mapToInt(Integer::parseInt).toArray();
        return parsedToInt;
    }

    public long readLongValue() throws IOException {
        String line = bufferedReader.readLine().replaceAll("\\s+$", "");
        long parsedToLong = Long.parseLong(line);
        return parsedToLong;
    }

    public long[] readLongNumbers() throws IOException {
        String[] line = bufferedReader.readLine().replaceAll("\\s+$", "").split(" ");
        long[] parsedToLong = Arrays.stream(line).mapToLong(Long::parseLong).toArray();
        return parsedToLong;
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.Scanner;

public class main {

	public static void main(String[] args) throws NumberFormatException, IOException{
Scanner sc=new Scanner(System.in);
String arr[]=new String[10];
for(int i=0;i<10;i++){
	arr[i]=sc.nextLine();
}

for(int i=0;i<10;i++){
int arr1[]=new int[11];
	for(int j=0;j<10;j++){
if(arr[i].charAt(j)=='.'){
	int left=0;
	int right=0;
	int up=0;
	int down=0;
	int dl=0;
	int ur=0;
	int ul=0;
	int dr=0;
	for(int k=j-1;k>=0;k--){
		if(arr[i].charAt(k)=='X') left++;
		else break;
	}
	for(int k=j+1;k<10;k++){
		if(arr[i].charAt(k)=='X') right++;
		else break;
	}
	for(int k=i-1;k>=0;k--){
		if(arr[k].charAt(j)=='X') up++;
		else break;
	}
	for(int k=i+1;k<10;k++){
		if(arr[k].charAt(j)=='X') down++;
		else break;
	}
	for(int k=j-1, l=i-1;l>=0&&k>=0;l--,k--){
		if(arr[l].charAt(k)=='X') ul++;
	}
	for(int k=j+1, l=i+1;l<10&&k<10;l++,k++){
		if(arr[l].charAt(k)=='X') dr++;
	}
	for(int k=j+1, l=i-1;l>=0&&k<10;l--,k++){
		if(arr[l].charAt(k)=='X') ur++;
	}
	for(int k=j-1, l=i+1;l<10&&k>=0;l++,k--){
		if(arr[l].charAt(k)=='X') dl++;
	}
	int yes=0;
	if(left+right>=4) yes=1;
	if(up+down>=4) yes=1;
	if(ul+dr>=4) yes=1;
	if(dl+ur>=4) yes=1;
	if(yes==1){ System.out.println("YES"); return;}

}
}
}
System.out.println("NO");

	}}

import java.util.Scanner;

public class Class {
	private static Scanner in = new Scanner(System.in);
	private static boolean gameWon = false;
	public static void main(String[] args) {
		String [] grid = new String[10];
		boolean [][] visit = new boolean[10][10];
		int move = 0;

		for (int i = 0; i < grid.length; i++) {
			grid[i] = in.nextLine();
		}
		for (int i = 0; i < 6 && !gameWon; i++) {
			checkDiagonalCol(grid, i);
			checkDiagonalRow(grid, i);
		}
		for(int i = 4;i < 9 ;i++)
		{
			checkInverseDiagonalCol(grid,i);
		}
		for(int i = 1;i < 6 ;i++)
		{
			checkInverseDiagonalRow(grid,i);
		}
		for (int i = 0; i < 10; i++) {
			checkHorizontal(grid, i);
			checkVertical(grid, i);
		}
		System.out.println(gameWon ? "YES" : "NO");

	}

	public static void checkDiagonalRow(String [] grid,int row)
	{
		int nX = 0;
		int nC = 0;
		int move = 0;
		while(checkLimits(row + 5 + move - 1, 0) && !gameWon)
		{
			for (int i = row + move; i < row + move + 5 ; i++) {
				int j = i - row;
				if(grid[i].charAt(j) == 'X')
				{
					nX++;
				}else if(grid[i].charAt(j) == '.')
				{
					nC++;
					if(nC > 1)
					{
						break;
					}
				}
				else if(grid[i].charAt(j) == 'O')
				{
					nX = 0;
					nC = 0;
					move = i - row;
					break;
				}
			}
			if(nC == 1 && nX == 4)
			{
				gameWon = true;
			}else
			{
				move++;
				nX = 0;
				nC = 0;
			}
		}
	}
	public static void checkDiagonalCol(String [] grid,int row)
	{
		int nX = 0;
		int nC = 0;
		int move = 0;
		while(checkLimits(0 , row + 5 + move - 1) && !gameWon)
		{
			for (int i = row + move; i < row + move + 5 ; i++) {
				int j = i - row;
				if(grid[j].charAt(i) == 'X')
				{
					nX++;
				}else if(grid[j].charAt(i) == '.')
				{
					nC++;
					if(nC > 1)
					{
						break;
					}
				}
				else if(grid[j].charAt(i) == 'O')
				{
					nX = 0;
					nC = 0;
					move = i - row;
					break;
				}
			}
			if(nC == 1 && nX == 4)
			{
				gameWon = true;
			}else
			{
				move++;
				nX = 0;
				nC = 0;
			}
		}
	}
	public static void checkInverseDiagonalCol(String [] grid,int row)
	{
		int nX = 0;
		int nC = 0;
		int move = 0;
		while(checkLimits(0 , row - 5 - move + 1) && !gameWon)
		{
			for (int i = row - move; i > row - move - 5 ; i--) {
				int j = row - i;
				if(grid[j].charAt(i) == 'X')
				{
					nX++;
				}else if(grid[j].charAt(i) == '.')
				{
					nC++;
					if(nC > 1)
					{
						break;
					}
				}
				else if(grid[j].charAt(i) == 'O')
				{
					nX = 0;
					nC = 0;
					move =row - i;
					break;
				}
			}
			if(nC == 1 && nX == 4)
			{
				gameWon = true;
			}else
			{
				move++;
				nX = 0;
				nC = 0;
			}
		}
	}
	public static void checkInverseDiagonalRow(String [] grid,int row)
	{
		int nX = 0;
		int nC = 0;
		int move = 0;
		while(checkLimits(row + 5 + move - 1 , 0) && !gameWon)
		{
			for (int i = row + move; i < row + move + 5 ; i++) {
				int j = 9 + row - i;
				if(grid[j].charAt(i) == 'X')
				{
					nX++;
				}else if(grid[j].charAt(i) == '.')
				{
					nC++;
					if(nC > 1)
					{
						break;
					}
				}
				else if(grid[j].charAt(i) == 'O')
				{
					nX = 0;
					nC = 0;
					move = i - row;
					break;
				}
			}
			if(nC == 1 && nX == 4)
			{
				gameWon = true;
			}else
			{
				move++;
				nX = 0;
				nC = 0;
			}
		}
	}
	public static void checkHorizontal(String [] grid,int row)
	{
		int nX = 0;
		int nC = 0;
		int move = 0;
		while(checkLimits(0, move + 5) && !gameWon)
		{
			for (int j =  move; j < 5 + move ; j++) {

				if(grid[row].charAt(j) == 'X')
				{
					nX++;
				}else if(grid[row].charAt(j) == '.')
				{
					nC++;
					if(nC > 1)
					{
						break;
					}
				}
				else if(grid[row].charAt(j) == 'O')
				{
					nX = 0;
					nC = 0;
					move = j;
					break;
				}
			}
			if(nC == 1 && nX == 4)
			{
				gameWon = true;
			}else
			{
				move++;
				nX = 0;
				nC = 0;
			}
		}
	}
	public static void checkVertical(String [] grid,int row)
	{
		int nX = 0;
		int nC = 0;
		int move = 0;
		while(checkLimits( move + 5,0) && !gameWon)
		{
			for (int j =  move; j < 5 + move ; j++) {

				if(grid[j].charAt(row) == 'X')
				{
					nX++;
				}else if(grid[j].charAt(row) == '.')
				{
					nC++;
					if(nC > 1)
					{
						break;
					}
				}
				else if(grid[j].charAt(row) == 'O')
				{
					nX = 0;
					nC = 0;
					move = j;
					break;
				}
			}
			if(nC == 1 && nX == 4)
			{
				gameWon = true;
			}else
			{
				move++;
				nX = 0;
				nC = 0;
			}
		}
	}
	public static boolean checkLimits(int i , int j)
	{
		return (i < 10 && i >= 0) && (j < 10 && j >= 0);
	}
}

//package codeforces;

import java.util.Scanner;

public class Task2_4 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[][][] arr = new int[10][10][4];
        boolean needToWork = true;
        for (int i = 0; i < 10; i++) {
            String s = in.nextLine();
            if (needToWork) {
                if (s.contains(".XXXX") || s.contains("X.XXX") || (s.contains("XX.XX")) || (s.contains("XXX.X")) || (s.contains("XXXX.")))
                    needToWork = false;
                else for (int j = 0; j < 10; j++) {
                    Character c = s.charAt(j);
                    if (c == 'O') {
                        arr[i][j][0] = -1;
                        arr[i][j][1] = -1;
                        arr[i][j][2] = -1;
                        arr[i][j][3] = 0;
                    } else if (c == 'X') {
                        if (i > 0) {
                            arr[i][j][0] = arr[i - 1][j][0] + 1;
                            if (j > 0) arr[i][j][1] = arr[i - 1][j - 1][1] + 1;
                            if (j < 9) arr[i][j][2] = arr[i - 1][j + 1][2] + 1;
                        } else {
                            arr[i][j][0] = 1;
                            arr[i][j][1] = 1;
                            arr[i][j][2] = 1;
                        }
                        arr[i][j][3] = 1;
                    } else {
                        if (i > 0) {
                            if (arr[i - 1][j][3] == 1) arr[i][j][0] = arr[i - 1][j][0] + 1;
                            else arr[i][j][0] = 0;
                            if (j > 0)
                                if (arr[i - 1][j - 1][3] == 1)
                                    arr[i][j][1] = arr[i - 1][j - 1][1] + 1;
                                else arr[i][j][1] = 0;
                            if (j < 9)
                                if (arr[i - 1][j + 1][3] == 1)
                                    arr[i][j][2] = arr[i - 1][j + 1][2] + 1;
                                else arr[i][j][2] = 0;
                        } else {
                            arr[i][j][0] = 0;
                            arr[i][j][1] = 0;
                            arr[i][j][2] = 0;
                        }
                        arr[i][j][3] = 2;
                    }
                    if ((arr[i][j][0] == 5) || (arr[i][j][1] == 5) || (arr[i][j][2] == 5))
                        needToWork = false;
                }
            }
        }
        if (needToWork) System.out.println("NO");
        else System.out.println("YES");
    }
}

import java.io.*;
import java.util.Arrays;

public class Main {

    private static myScanner sc;
    private static PrintWriter pw;

    private static final boolean defaultInAndOutPut = true;

    private static final int numberOfTests = 1;

    private static final String nameOfInAndOutFile = "";
    private static final String fullNameInputFile = nameOfInAndOutFile + ".in";
    private static final String fullNameOutputFile = nameOfInAndOutFile + ".out";

    public static void main(String[] args) throws IOException {
        if (defaultInAndOutPut) {
            setDefaultInAndOutPut();
        } else {
            setInAndOutPutFromFile();
        }
        for (int test = 1; test <= numberOfTests; test++) {
            solve();
            pw.flush();
        }

        pw.close();
    }

    private static void setDefaultInAndOutPut() {
        sc = new myScanner(new BufferedReader(new InputStreamReader(System.in)));
        pw = new PrintWriter(System.out);
    }

    private static void setInAndOutPutFromFile() throws IOException {
        sc = new myScanner(new BufferedReader(new FileReader(new File(fullNameInputFile))));
        pw = new PrintWriter(new File(fullNameOutputFile));
    }

    private static final int intINF = Integer.MAX_VALUE;
    private static final long longINF = Long.MAX_VALUE;

    private static void solve() {
        int[][] s = new int[10][10];
        for (int i=0;i<10;i++){
            String m = sc.nextLine();
            for (int j=0;j<10;j++){
                if (m.charAt(j)=='O')s[i][j]=-100;
                else if (m.charAt(j)=='X')s[i][j]=1;
            }
        }
        boolean ans = false;
        for (int i=0;i<10;i++){
            for (int j=0;j<6;j++){
                int sum =0;
                for (int k=0;k<5;k++)sum+=s[i][j+k];
                if (sum==4)ans=true;
            }
        }
        for (int i=0;i<10;i++){
            for (int j=0;j<6;j++){
                int sum =0;
                for (int k=0;k<5;k++)sum+=s[j+k][i];
                if (sum==4)ans=true;
            }
        }
        for (int i=0;i<6;i++){
            for (int j=0;j<6;j++){
                int sum=0;
                for (int k=0;k<5;k++)sum+=s[j+k][i+k];
                if (sum==4)ans=true;
            }
        }
        for (int i=9;i>3;i--){
            for (int j=9;j>3;j--){
                int sum=0;
                for (int k=0;k<5;k++)sum+=s[j-k][i-k];
                if (sum==4)ans=true;
            }
        }
        pw.print(ans?"YES":"NO");
    }
}

class myScanner {
    private char[] buffer = new char[1 << 8];
    private int pos = 1;

    private BufferedReader reader;

    public myScanner(BufferedReader reader) {
        this.reader = reader;
    }

    public boolean hasNext() {
        return pos > 0;
    }

    private void loadBuffer() {
        pos = 0;
        try {
            for (int i; (i = reader.read()) != -1; ) {
                char c = (char) i;
                if (c != ' ' && c != '\n' && c != '\t' && c != '\r' && c != '\f') {
                    if (pos == buffer.length) buffer = Arrays.copyOf(buffer, 2 * pos);
                    buffer[pos++] = c;
                } else if (pos != 0) break;
            }
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    public String current() {
        return String.copyValueOf(buffer, 0, pos);
    }

    public String next() {
        loadBuffer();
        return current();
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    public int nextInt() {
        return nextInt(10);
    }

    public long nextLong() {
        return nextLong(10);
    }

    public int nextInt(int radix) {
        loadBuffer();
        int result = 0;
        int i = buffer[0] == '-' || buffer[0] == '+' ? 1 : 0;
        for (checkValidNumber(pos > i); i < pos; i++) {
            int digit = buffer[i] - '0';
            checkValidNumber(0 <= digit && digit <= radix - 1);
            result = result * radix + digit;
        }
        return buffer[0] == '-' ? -result : result;
    }

    public long nextLong(int radix) {
        loadBuffer();
        long result = 0;
        int i = buffer[0] == '-' || buffer[0] == '+' ? 1 : 0;
        for (checkValidNumber(pos > i); i < pos; i++) {
            int digit = buffer[i] - '0';
            checkValidNumber(0 <= digit && digit <= radix - 1);
            result = result * radix + digit;
        }
        return buffer[0] == '-' ? -result : result;
    }

    public int[] nextArrayInts(int size){
        int[] input = new int[size];
        for (int i=0;i<size;i++)input[i]=nextInt();
        return input;
    }

    public long[] nextArrayLongs(int size){
        long[] input = new long[size];
        for (int i=0;i<size;i++)input[i]=nextLong();
        return input;
    }

    public double nextDouble() {
        loadBuffer();
        long result = 0;
        int i = buffer[0] == '-' || buffer[0] == '+' ? 1 : 0;
        long round = 1;
        final int radix = 10;
        boolean hasPoint = false;
        for (checkValidNumber(pos > i); i < pos; i++) {
            int digit = buffer[i] - '0';
            checkValidNumber((0 <= digit && digit <= radix - 1) || (!hasPoint && digit == -2));
            if (digit == -2) hasPoint = true;
            else {
                if (hasPoint) round *= radix;
                result = result * radix + digit;
            }

        }
        return buffer[0] == '-' ? -result / (1.0 * round) : result / (1.0 * round);
    }

    private void checkValidNumber(boolean condition) {
        if (!condition) throw new NumberFormatException(current());
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{
	public static void main(String args[]){
		InputReader scan = new InputReader();
		char[][] c = new char[10][10];
		for(int i = 0; i < 10; i++){
			String str = scan.next();
			for(int j = 0; j < str.length(); j++)
				c[i][j] = str.charAt(j);
		}
		if(checkHorizontal(c) || checkVertical(c) || checkDiagonal1(c) || checkDiagonal2(c))
			System.out.println("YES");
		else
			System.out.println("NO");
	}

	static boolean checkHorizontal(char[][] c){
		int counter = 0, counterFromFree = 0;
		boolean free = false;
		for(int i = 0; i < 10; i++){
			for(int j = 0; j < 10; j++){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						counterFromFree = 0;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
		}
		return false;
	}

	static boolean checkVertical(char[][] c){
		int counter = 0, counterFromFree = 0;
		boolean free = false;
		for(int j = 0; j < 10; j++){
			for(int i = 0; i < 10; i++){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						counterFromFree = 0;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
		}
		return false;
	}

	static boolean checkDiagonal1(char[][] c){
		int counter = 0, counterFromFree = 0;
		boolean free = false;
		for(int k = 0; k < 10; k++){
			for(int j = 0, i = k; j < 10 && i < 10; j++, i++){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						counterFromFree = 0;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
			counter = 0;
			counterFromFree = 0;
			free = false;
			for(int i = 0, j = k; i < 10 && j < 10; j++, i++){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						counterFromFree = 0;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
		}
		return false;
	}

	static boolean checkDiagonal2(char[][] c){
		int counter = 0, counterFromFree = 0;
		boolean free = false;
		for(int k = 0; k < 10; k++){
			for(int j = 0, i = k; j < 10 && i >= 0; j++, i--){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						counterFromFree = 0;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
			counter = 0;
			counterFromFree = 0;
			free = false;
			for(int j = k, i = 0; i < 10 && j >= 0; i++, j--){
				if(c[i][j] == 'X'){
					counter++;
					if(free) counterFromFree++;
				}
				else if(c[i][j] == '.'){
					if(!free){
						free = true;
						counter++;
					}
					else{
						if(counter >= 5) return true;
						counter = counterFromFree;
						counterFromFree = 0;
						free = false;
					}
				}
				else{
					if(counter >= 5) return true;
					counter = 0;
					counterFromFree = 0;
					free = false;
				}
			}
		}
		return false;
	}

	//Custom Scanner

	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader() {
            reader = new BufferedReader(new InputStreamReader(System.in));
            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());
        }

    }

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author HossamDoma
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {

            int[][] maze = new int[10][10];

            for (int i = 0; i < 10; ++i) {
                String line = in.next();
                for (int j = 0; j < 10; ++j) {
                    maze[i][j] = line.charAt(j) == 'X' ? 1 : line.charAt(j) == 'O' ? -1 : 0;
                }
            }

            boolean ok = false;

            //Horizontal
            for (int i = 0; i < 10; ++i) {

                int sum = 0;

                for (int j = 0; j < 10; ++j) {

                    if (j >= 5) sum -= maze[i][j - 5];

                    sum += maze[i][j];

                    if (sum >= 4) {
                        out.println("YES");
                        return;
                    }
                }
            }

            //Vertical
            for (int j = 0; j < 10; ++j) {

                int sum = 0;

                for (int i = 0; i < 10; ++i) {

                    if (i >= 5) sum -= maze[i - 5][j];

                    sum += maze[i][j];

                    if (sum >= 4) {
                        out.println("YES");
                        return;
                    }
                }
            }

            //Diagonal
            for (int i = 0; i + 5 <= 10; ++i) {

                int sum = 0;
                int j = 0;

                for (int k = i; k < 10; ++k, j++) {

                    if (j >= 5) sum -= maze[k - 5][j - 5];

                    sum += maze[k][j];

                    if (sum >= 4) {
                        out.println("YES");
                        return;
                    }
                }
            }

            for (int j = 0; j + 5 <= 10; ++j) {

                int sum = 0;
                int i = 0;

                for (int k = j; k < 10; ++k, i++) {

                    if (i >= 5)
                        sum -= maze[i - 5][k - 5];

                    sum += maze[i][k];

                    if (sum >= 4) {
                        out.println("YES");
                        return;
                    }
                }
            }

            //Anti-Diagonal
            for (int i = 0; i + 5 <= 10; ++i) {

                int sum = 0;
                int j = 9;

                for (int k = i; k < 10; ++k, j--) {

                    if (j < 5)
                        sum -= maze[k - 5][j + 5];

                    sum += maze[k][j];

                    if (sum >= 4) {
                        out.println("YES");
                        return;
                    }
                }
            }

            for (int j = 9; j - 4 >= 0; --j) {

                int sum = 0;
                int i = 0;

                for (int k = j; k >= 0; --k, i++) {

                    if (i >= 5)
                        sum -= maze[i - 5][k + 5];

                    sum += maze[i][k];

                    if (sum >= 4) {
                        out.println("YES");
                        return;
                    }
                }
            }

            out.println("NO");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public 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();
        }

    }
}

import java.util.Scanner;

public class TestThree {

    public static void main(String[] args) {

        Scanner reader = new Scanner(System.in);
        char[][] playField = new char[10][];
        for (int i = 0; i < 10; i++) {
            String row = reader.nextLine();
            playField[i] = row.toCharArray();
        }

        for (int row = 0; row < 10; row++) {
            for (int column = 0; column < 10; column++) {

                if (checkFiveInColumn(playField, row, column) ||
                        checkFiveInRow(playField, row, column) ||
                        checkFiveInDiagonalLeft(playField, row, column) ||
                        checkFiveInDiagonalRight(playField, row, column)) {
                    System.out.println("YES");
                    return;
                }
            }
        }

        System.out.println("NO");
    }

    private static boolean checkFiveInRow(char[][] playField, int column, int row) {

        int count = 0;
        int i = column;
        for (int j = 0; j < 5; j++) {
            if (playField[row][i] == 'O') {
                break;
            }
            if (playField[row][i] == 'X') {
                count++;
            }
            i++;
            if (i >= 10) break;
        }
        return count == 4;

    }

    private static boolean checkFiveInColumn(char[][] playField, int column, int row) {

        int count = 0;
        int i = row;
        for (int j = 0; j < 5; j++) {
            if (playField[i][column] == 'O') {
                break;
            }
            if (playField[i][column] == 'X') {
                count++;
            }
            i++;
            if (i >= 10) break;
        }
        return count == 4;
    }

    private static boolean checkFiveInDiagonalRight(char[][] playField, int column, int row) {
        if ((column - 4) < 0 || (row + 4) >= 10) {
            return false;
        }

        int count = 0;
        for (int j = 0; j < 5; j++) {
            if (playField[row + j][column - j] == 'O') {
                break;
            }
            if (playField[row + j][column - j] == 'X') {
                count++;
            }
        }

        boolean result = (count == 4);
        return result;
    }

    private static boolean checkFiveInDiagonalLeft(char[][] playField, int column, int row) {
        if ((row + 4) >= 10 || (column + 4) >= 10) {
            return false;
        }

        int count = 0;
        for (int j = 0; j < 5; j++) {
            if (playField[row + j][column + j] == 'O') {
                break;
            }
            if (playField[row + j][column + j] == 'X') {
                count++;
            }
        }
        boolean result = (count == 4);
        return result;

    }
}