eolymp
bolt
Try our new interface for solving problems
Problems

Tricky Sorting

Tricky Sorting

The sequence of numbers is given. Arrange them in non-decreasing order of the last digit, and in the case of equality of last digits --- arrange the numbers in non-decreasing order. \InputFile The first line contains number $n~(1 \le n \le 100)$, and next lines contain the positive integers not greater than $32000$. \OutputFile Print the sequence of numbers ordered as given in problem statement.
Time limit 1 second
Memory limit 128 MiB
Input example #1
7
12
15
43
13
20
1
15
Output example #1
20 1 12 13 43 15 15
Input example #2
2
1004
1002
Output example #2
1002 1004