A sequence of numbers is given. These numbers need to be sorted by their last digits in ascending order, and if the last digits are equal, by the numbers themselves in ascending order.
The first line contains the number n~(1 \le n \le 100), and the second line contains the numbers themselves, which do not exceed .
You should provide the sequence of numbers sorted according to the conditions given.
Example 1
Example 2