#K54407. Final Queue Positions
Final Queue Positions
Final Queue Positions
You are given several test cases. In each test case, there are N people with given positions in a queue. Your task is to determine the final positions of the people after they have rearranged themselves in increasing order. In other words, for each test case, you need to sort the list of positions in ascending order and print them as a space-separated string.
The problem can be mathematically formulated as follows. Given a sequence \(a_1, a_2, \dots, a_N\), compute the sequence \(b_1, b_2, \dots, b_N\) such that \(b_1 \le b_2 \le \dots \le b_N\) and \(\{b_1, \dots, b_N\} = \{a_1, \dots, a_N\}\).
Make sure to use efficient sorting since the number of positions in a test case can be large.
inputFormat
The first line of input contains an integer T representing the number of test cases. For each test case, the first line contains an integer N denoting the number of positions, followed by a line containing N space-separated integers.
outputFormat
For each test case, print a single line with the sorted positions in increasing order, separated by a single space.
## sample1
5
3 9 7 1 5
1 3 5 7 9
</p>