This article shows how to solve the N queens problem in 20 lines of code.
Why is 6 afraid of 7? Because 7 8 9.