input: def towers_of_hanoi(n, source, spare, target):
      """
      Solves the Towers of Hanoi puzzle for n disks.
      Moves the disks from the source peg to the target peg using the spare peg as auxiliary.
      Prints each move.
      
      >>> towers_of_hanoi(3, [3, 2, 1], [], [])
      Moving disk 1 from A to C
      Moving disk 2 from A to B
      Moving disk 1 from C to B
      Moving disk 3 from A to C
      Moving disk 1 from B to A
      Moving disk 2 from B to C
      Moving disk 1 from A to C
      """
      if n == 1:
          disk = source.pop()
          print("Moving disk {0} from {1} to {2}".format(disk, [x[1] for x in source] if source else 'A', [x[1] for x in target] if target else 'C'))
          target.append(disk)
      else:
          towers_of_hanoi(n-1, source, target, spare)
          disk = source.pop()
          print("Moving disk {0} from {1} to {2}".format(disk, [x[1] for x in source] if source else 'A', [x[1] for x in target] if target else 'C'))
          target.append(disk)
          towers_of_hanoi(n-1, spare, source, target)
output:     if n == 1:
          disk = source.pop()
          print("Moving disk {0} from {1} to {2}".format(disk, 'A', 'C'))
          target.append(disk)
      else:
          towers_of_hanoi(n-1, source, target, spare)
          disk = source.pop()
          print("Moving disk {0} from {1} to {2}".format(disk, 'A', 'C'))
          target.append(disk)
          towers_of_hanoi(n-1, spare, source, target)