def check_ship_placement(field):
    ship_sizes = [4, 3, 3, 2, 2, 2, 1, 1, 1, 1]
    ship_counts = [1, 2, 3, 4]

    for i in range(10):
        for j in range(10):
            if field[i][j] == '#':
                if i > 0 and field[i-1][j] == '#':
                    return "NO"
                if j > 0 and field[i][j-1] == '#':
                    return "NO"
                if i < 9 and field[i+1][j] == '#':
                    return "NO"
                if j < 9 and field[i][j+1] == '#':
                    return "NO"

                for size in ship_sizes:
                    if size > 1:
                        if (i + size <= 10 and all(field[i+k][j] == '#' for k in range(size))) or \
                                (j + size <= 10 and all(field[i][j+k] == '#' for k in range(size))):
                            ship_sizes.remove(size)
                            break
                else:
                    ship_sizes.remove(1)
                    ship_counts.remove(1)

    return "YES" if not ship_sizes and not ship_counts else "NO"

field = [
    "#.#.#.....",
    ".......##.",
    ".#..#.....",
    ".#........",
    ".#..##....",
    "..........",
    "####...#..",
    ".......#..",
    ".......#..",
    "##........"
]

result = check_ship_placement(field)
print(result)

