input: Write a function to solve the Towers of Hanoi game. The function should take the number of disks, the source peg, the spare peg, and the target peg as inputs. It should print the moves required to solve the problem. Return nothing.
  def hanoi(n, source, spare, target):
      if n == 1:
          disk = source.pop(0)
          print("Moving disk {0} from {1} to {2}".format(disk[0], disk[1], target[1]))
          target.insert(0, disk)
      else:
          hanoi(n-1, source, target, spare)
          disk = source.pop(0)
          print("Moving disk {0} from {1} to {2}".format(disk[0], disk[1], target[1]))
          target.insert(0, disk)
          hanoi(n-1, spare, source, target)
  
  n = 3
  source = [(i, "A") for i in range(1, n+1)]
  target = []
  spare = []
  
  hanoi(n, source, spare, target)
  
  assert hanoi(3, [(i, "A") for i in range(1, 4)], [], [])
  assert hanoi(4, [(i, "A") for i in range(1, 5)], [], [])
  assert hanoi(0, [], [], [])
  assert hanoi(1, [(1, "A")], [], [])
  assert hanoi(2, [(i, "A") for i in range(1, 3)], [], [])
output: def hanoi(n, source, spare, target):
      if n == 1:
          disk = source.pop(0)
          print("Moving disk {0} from {1} to {2}".format(disk[0], disk[1], target[1]))
          target.insert(0, disk)
      else:
          hanoi(n-1, source, target, spare)
          disk = source.pop(0)
          print("Moving disk {0} from {1} to {2}".format(disk[0], disk[1], target[1]))
          target.insert(0, disk)
          hanoi(n-1, spare, source, target)