input: Write a function to solve the Towers of Hanoi game. The function should take the number of disks (n), the source peg, the spare peg, and the target peg as input, and print the moves required to transfer all disks from the source peg to the target peg. If there is only one disk, it should print the move directly. If there are more than one disk, it should recursively move the top n-1 disks to the spare peg, move the nth disk to the target peg, and then move the n-1 disks from the spare peg to the target peg. The input will be a list of tuples representing the disks and their current peg. The output should be a printed sequence of moves.
  
  assert hanoi(8, [(i, "A") for i in range(1, 9)], [], [])
  assert hanoi(1, [(1, "A")], [], [1, "B"])
  assert hanoi(2, [(2, "A"), (1, "A")], [], [(2, "B"), (1, "B")])
  assert hanoi(3, [(3, "A"), (2, "A"), (1, "A")], [], [(3, "B"), (2, "B"), (1, "B")])
  assert hanoi(0, [], [], [])
output: def hanoi(n, source, spare, target):
      def move(n, source, target, spare):
          if n == 1:
              print(f"Move disk 1 from {source} to {target}")
          else:
              move(n-1, source, spare, target)
              print(f"Move disk {n} from {source} to {target}")
              move(n-1, spare, target, source)
      move(n, 'A', 'B', 'C')