A sequence of numbers is given. Sort these numbers in non-decreasing order according to their last digit; if the last digits are equal, sort these numbers themselves in non-decreasing order.
The first line contains the number n~(1 \le n \le 100), and the second line contains positive integers, each not greater than .
Print the sequence of numbers sorted according to the described rules.
Example 1
Example 2