def hanoi(n, source, spare, target): 
    if n > 0: 
        # Step 1: Move n-1 disks from Source to Spare. 
        hanoi(n-1, source, target, spare) 
  
        # Step 2: Move the nth disk from Source to Target. 
        target.push(source.pop())
  
        # Step 3: Move n-1 disks from Spare to Target. 
        hanoi(n-1, spare, source, target)
Scrivi un algoritmo per le Torri di Hanoi.