Vietnam Crisis

3.5

13 votes
Problem

In 1945, Vietnam had a huge famine because of which thousands of Vietnamese people were dying everyday. The Soviet Union wanted to help the Vietnamese. They were regualrly sending food supplies to Vietnam. The Vietnamese officials decided that they would provide food to the children first. (Food supplies included food for an infant to very old man). Also food would be provided in increasing order of age.

Vietnamese officials have reached a village and have employed you to form a line of the people who will be getting food in the order as they require (that is, in increasing order of age). When the officials landed, a line already existed but it was not in increasing order. You are required to make it as per the officials wishes.

The population of the village is very large (upto 20000000). Typically, in other countries, this much population would constitute a town.

Input:

There are multiple test cases. Each case starts with an integer N, the total number of people. In the next line, there are N integers indicating the ages. Input is terminated with a case where N = 0 . This case should not be processed.

Output:

For each case, print a line with N space separated integers in the increasing order of age.

Note: Use faster IO since some test cases can be very large

Constraints:

1 <= T <= 10

1 <= N <= 20000000

All ages are in integers only

Time Limit: 3
Memory Limit: 256
Source Limit:
Editor Image

?