def is_valid_battleship(board):
    n = len(board)
    if n == 0:
        return True

    ship_count = [0, 0, 0, 0, 1]
    ship_locations = []
    for i in range(n):
        for j in range(n):
            if board[i][j] == '#':
                if not check_neighbors(board, i, j):
                    return False
                size = find_ship_size(board, i, j)
                ship_count[size - 1] += 1
                ship_locations.append((i, j, size))


    for count, ship in zip(ship_count, ships):
        if count != ship:
            return False


    for i in range(len(ship_locations)):
        for j in range(i + 1, len(ship_locations)):
            if ships_are_adjacent(ship_locations[i], ship_locations[j]) or ships_intersect(ship_locations[i], ship_locations[j]):
                return False

    return True

def check_neighbors(board, i, j):
    directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
    for di, dj in directions:
        ni, nj = i + di, j + dj
        if 0 <= ni < len(board) and 0 <= nj < len(board[0]):
            if board[ni][nj] == '#':
                return False
    return True

def find_ship_size(board, i, j):
    directions = [(0, 1), (1, 0), (0, -1), (-1, 0)]
    for size in range(1, 5):
        for di, dj in directions:
            for step in range(1, size):
                ni, nj = i + di * step, j + dj * step
                if not(0 <= ni < len(board) and 0 <= nj < len(board[0])) or board[ni][nj] == '.':
                    return size - 1
    return 5

def ships_are_adjacent(ship1, ship2):
    i1, j1, size1 = ship1
    i2, j2, size2 = ship2
    return (abs(i1 - i2) + abs(j1 - j2) == 1 and size1 == size2)

def ships_intersect(ship1, ship2):

    i1, j1, size1 = ship1
    i2, j2, size2 = ship2
    if size1 < size2:
        size1, size2 = size2, size1
        i1, j1, i2, j2 = i2, j2, i1, j1
    return (i1 <= i2 + size2 - 1 and i1 + size1 - 1 >= i2 and
            j1 <= j2 + size2 - 1 and j1 + size1 - 1 >= j2)

def solve(board):
    if is_valid_battleship(board):
        return "YES"
    else:
        return "NO"

board = []
for _ in range(10):
    row = input()
    board.append(row)

print(solve(board))
