solution to queen problem