def is_valid_battleship_field(field):
    # Создаем словарь для отслеживания количества кораблей каждого типа
    ship_counts = {'4': 1, '3': 2, '2': 3, '1': 4}

    # Проверка по горизонтали
    for i in range(10):
        consecutive_dots = 0
        for j in range(10):
            if field[i][j] == '#':
                if consecutive_dots == 0:
                    if j > 0 and field[i][j - 1] == '#':
                        return "NO"
                    if i > 0 and field[i - 1][j] == '#':
                        return "NO"
                consecutive_dots = 0
            else:
                consecutive_dots += 1
                if consecutive_dots > 1:
                    return "NO"
            if ship_counts.get(str(consecutive_dots)) is not None:
                ship_counts[str(consecutive_dots)] -= 1
                if ship_counts[str(consecutive_dots)] < 0:
                    return "NO"

    # Проверка по вертикали
    for j in range(10):
        consecutive_dots = 0
        for i in range(10):
            if field[i][j] == '#':
                if consecutive_dots == 0:
                    if j > 0 and field[i][j - 1] == '#':
                        return "NO"
                    if i > 0 and field[i - 1][j] == '#':
                        return "NO"
                consecutive_dots = 0
            else:
                consecutive_dots += 1
                if consecutive_dots > 1:
                    return "NO"
            if ship_counts.get(str(consecutive_dots)) is not None:
                ship_counts[str(consecutive_dots)] -= 1
                if ship_counts[str(consecutive_dots)] < 0:
                    return "NO"

    return "YES" if all(val == 0 for val in ship_counts.values()) else "NO"

# Считываем поле
field = [input() for _ in range(10)]

# Проверяем корректность поля и выводим результат
result = is_valid_battleship_field(field)
print(result)