Given a list of pairs, you are asked to sort them in increasing order based on the second element. So, when looking at the final list of the pairs, the second element should be a non-decreasing sequence.
The first line of the input contains a single integer
n- the number of pairs. The next
nlines contain 2 integers separated by a space.
The program should print
nlines containing the resulting list. Each line should have two integers separated by a space.
Input 3 10 4 12 1 6 7 Output 12 1 10 4 6 7