solve the NQueens question