The Tower of Hanoi is a mathematical game or puzzle. It consists of three towers and a number of disks of different sizes, which can slide onto any tower. The puzzle starts with the disks in a stack in ascending order (the smallest at the top). The objective of the puzzle is to move the entire stack from first to the last tower, obeying the following rules:

1- Only one disk can be moved at a time.
2- Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack or on an empty tower.
3- No disk may be placed on top of a smaller disk.