import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

immutable long INF = 1L << 60;
const int N = 10;
const int M = 5;

void main() {
    auto B = N.iota.map!(_ => readln.chomp).array;
    auto C = ["pppppppppppppppppppp",
              "pppppppppppppppppppp",
              "pppppppppppppppppppp",
              "pppppppppppppppppppp",
              "pppppppppppppppppppp"];
    foreach (i; 0..N) B[i] = "ppppp" ~ B[i] ~ "ppppp";
    B = C ~ B ~ C;

    int batu, nasi;

    foreach (i; 5..N+5) {
        foreach (j; 5..N+5) {
            batu = 0;
            nasi = 0;
            foreach (k; 0..M) {
                if (B[i][j+k] == 'X') batu += 1;
                if (B[i][j+k] == '.') nasi += 1;
            }
            if (batu == 4 && nasi == 1) {
                writeln("YES");
                return;
            }

            batu = 0;
            nasi = 0;
            foreach (k; 0..M) {
                if (B[i+k][j] == 'X') batu += 1;
                if (B[i+k][j] == '.') nasi += 1;
            }
            if (batu == 4 && nasi == 1) {
                writeln("YES");
                return;
            }

            batu = 0;
            nasi = 0;
            foreach (k; 0..M) {
                if (B[i+k][j+k] == 'X') batu += 1;
                if (B[i+k][j+k] == '.') nasi += 1;
            }
            if (batu == 4 && nasi == 1) {
                writeln("YES");
                return;
            }

            batu = 0;
            nasi = 0;
            foreach (k; 0..M) {
                if (B[i-k][j+k] == 'X') batu += 1;
                if (B[i-k][j+k] == '.') nasi += 1;
            }
            if (batu == 4 && nasi == 1) {
                writeln("YES");
                return;
            }
        }
    }

    writeln("NO");
}
