input: Write a function to solve the Towers of Hanoi game, which takes the number of disks (n), the source peg, the spare peg, and the target peg as parameters, and prints the sequence of moves to solve the puzzle. If there is only one disk, it moves directly from the source to the target. For more than one disk, it recursively moves the top n-1 disks to the spare peg, then moves the nth disk to the target, and finally moves the n-1 disks from the spare to the target.
  assert hanoi(3, [(1, "A"), (2, "A"), (3, "A")], [], [])==None
  assert hanoi(2, [(1, "A"), (2, "A")], [], [])==None
  assert hanoi(1, [(1, "A")], [], [])==None
  assert hanoi(4, [(1, "A"), (2, "A"), (3, "A"), (4, "A")], [], [])==None
  assert hanoi(0, [], [], [])==None
output: def hanoi(n, source, spare, target):
      if n == 1:
          print(f"Move disk 1 from {source[0][1]} to {target[0][1]}")
          target.append(source.pop())
      else:
          hanoi(n-1, source, target, spare)
          print(f"Move disk {n} from {source[-1][1]} to {target[0][1]}")
          target.append(source.pop())
          hanoi(n-1, spare, source, target)