solving the puzzle