Solving n-queens problem with dancing links algorithm