Solving Magic Puzzle