Towers of Hanoi exercise