input: Write a function to solve the Towers of Hanoi game. The function should recursively move the disks from the source rod to the target rod using a spare rod, and print each move. If there is only one disk, move it directly from the source to the target. If there are multiple disks, move n-1 disks from the source to the spare, then move the nth disk to the target, and finally move the n-1 disks from the spare to the target. The function should output the steps it takes to move all disks to the target.
  assert hanoi(1, [(1, "A")], [], [])==[("Moving disk 1 from A to A")]
  assert hanoi(2, [(1, "A"), (2, "A")], [], [])==[("Moving disk 1 from A to B"), ("Moving disk 2 from A to C"), ("Moving disk 1 from B to C")]
  assert hanoi(3, [(1, "A"), (2, "A"), (3, "A")], [], [])==[("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")]
  assert hanoi(0, [], [], [])==[]
output: def hanoi(n, source, target, spare):
      moves = []
      if n == 1:
          moves.append(f"Moving disk {source[0][0]} from {source[0][1]} to {target[0][1]}")
      else:
          moves += hanoi(n-1, source, spare, target)
          moves.append(f"Moving disk {source[0][0]} from {source[0][1]} to {target[0][1]}")
          moves += hanoi(n-1, spare, target, source)
      return moves