modify the solution to N-Queens II