The Tower of Hanoi is a puzzle with three rods and n disks of different sizes. All disks start on the first rod, ordered by size (largest at bottom). Move all disks to the last rod following these rules: move one disk at a time, only the topmost disk can be moved, and a larger disk cannot be placed on a smaller disk. Given n, print all moves to solve the puzzle. Rods are numbered 1, 2, 3. Output each move as "from to" on a separate line.
Example 1:
Example 2:
Constraints:
1 <= n <= 20
Tags:
