Algorithm For N Queens Problem