Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts.

In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she wins immediately.

Alice wins if some crosses in the field form line of length not smaller than 5. This line can be horizontal, vertical and diagonal.

Input

You are given matrix 10 × 10 (10 lines of 10 characters each) with capital Latin letters 'X' being a cross, letters 'O' being a nought and '.' being an empty cell. The number of 'X' cells is equal to the number of 'O' cells and there is at least one of each type. There is at least one empty cell.

It is guaranteed that in the current arrangement nobody has still won.

Output

Print 'YES' if it's possible for Alice to win in one turn by putting cross in some empty cell. Otherwise print 'NO'.

Examples

Input

XX.XX.....
.....OOOO.
..........
..........
..........
..........
..........
..........
..........
..........


Output

YES


Input

XXOXX.....
OO.O......
..........
..........
..........
..........
..........
..........
..........
..........


Output

NO
import java.io.FileInputStream;
import java.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;
    }
  }


}
