N-queens problem in prolog