printing in the ascending order