
def mineral_formation(cave):
    a = cave[0].count(1) >= 1
    b = cave[-1].count(1) >= 1
    return "both" if a and b else "stalagmites" if b else "stalactites"


3725d34c3b369288e6788b76df4c564cbc1ba68b
<mask token>

def mineral_formation(cave):
    a = cave[0].count(1) >= 1
    b = cave[-1].count(1) >= 1
    return 'both' if a and b else 'stalagmites' if b else 'stalactites'


def mineral_formation(cave):
    a = cave[0].count(1) >= 1
    b = cave[-1].count(1) >= 1
    return "both" if a and b else "stalagmites" if b else "stalactites"

