Write an algorithm to 8-queen problem or write an algorithm for tower of hanoi (not recursive)