solution to n queens problem using backtracking