def check_battleship_placement(field):
    # Проверка количества '#' на поле
    if sum(row.count("#") for row in field) != 20:
        return "NO"

    # Проверка размера каждого корабля
    ships = {
        "four-decker": 1,
        "three-decker": 2,
        "two-decker": 3,
        "single-decker": 4
    }
    for size, count in ships.items():
        if field_contains_ships_of_size(field, size) != count:
            return "NO"

    # Проверка размещения кораблей
    for i in range(len(field)):
        for j in range(len(field[i])):
            if field[i][j] == "#":
                if not is_valid_ship_placement(field, i, j):
                    return "NO"

    return "YES"


def field_contains_ships_of_size(field, size):
    count = 0
    if size == "four-decker":
        for i in range(len(field)):
            for j in range(len(field[i]) - 3):
                if field[i][j:j+4] == ["#"] * 4:
                    count += 1
    else:
        ship_length = int(size[0])
        for i in range(len(field)):
            for j in range(len(field[i]) - ship_length + 1):
                if field[i][j:j+ship_length] == ["#"] * ship_length:
                    count += 1
    return count


def is_valid_ship_placement(field, i, j):
    # Проверка вертикального размещения
    if i + 1 < len(field) and field[i + 1][j] == "#":
        return False
    # Проверка горизонтального размещения
    if j + 1 < len(field[i]) and field[i][j + 1] == "#":
        return False
    return True


# Примеры тестовых полей
field1 = ["#.#.#.....",
          "......##.#",
          ".#..#.....",
          ".#........",
          ".#..##....",
          "..........",
          "####...#..",
          ".......#..",
          ".......#..",
          "##........"]

field2 = ["##..#.....",
          "......##.#",
          ".#..#....#",
          ".#........",
          ".#........",
          "..........",
          "####...#..",
          ".......#..",
          ".......#..",
          "##.......#"]

print(check_battleship_placement(field1))  # Ожидаемый результат: "YES"
print(check_battleship_placement(field2))  # Ожидаемый результат: "NO"
