solves N-puzzles with A* search