implement the queen problem