Refactor Eight Queens Puzzle