Solves the queens problem (how to place the max number of queens on a chess board of size N)