def solve_hanoi(source_peg, target_peg, other_peg, num_disks):
    """Prints out the instructions for moving num_disks (ordered
    smallest to largest, going down) from the source_peg to the 
    target_peg, using the other_peg, as needed.

    Preconditions: 
    source_peg, target_peg, and other_peg are strings
    num_disks is an integer"""
    
    if num_disks == 1:
        # it's easy to move just 1 disk!
        print("move from " + source_peg + " to " + target_peg)
        
    else:
    
        # it's harder to move multiple disks. We have to first move
        # the top n-1 disks temporarily to "other" then move the
        # largest disk to the target peg. Then move the remaining n-1
        # disks back on top of thh largest @ target.

        # temporarily move all but the last disk to the "other peg"
        # how can we do this? Check the specs of THIS FUNCTION. It
        # can do exactly this!
        solve_hanoi(source_peg, other_peg, target_peg, num_disks-1)
        
        # move the last disk to the target peg 
        print("move from " + source_peg + " to " + target_peg)

        # now move all but the last disk to the target peg
        # again, how can we do this? we can call THIS FUNCTION
        solve_hanoi(other_peg, target_peg, source_peg, num_disks-1)


n_disks = int(input("How many disks are on your tower? "))
print("That's easy! Here's what you do: ")

solve_hanoi("left", "right", "middle", n_disks)