Add N Queens problem resolving algorithm