input: Write a function to solve the Towers of Hanoi game. The function should take four parameters: the number of disks `n`, the source peg `source`, the spare peg `spare`, and the target peg `target`. It should print the moves required to solve the game and move all disks from the source peg to the target peg.
  
  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)], [], []) == None
  assert hanoi(2, [(i, "A") for i in range(1, 3)], [], []) == None
  assert hanoi(1, [(1, "A")], [], []) == None
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)