Tricky Sorting#349

Tricky Sorting

1 second
128 megabytes
Easy (≈1000)

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.

Input

The first line contains the number n~(1 \le n \le 100), and the second line contains the numbers themselves, which do not exceed .

Output

You should provide the sequence of numbers sorted according to the conditions given.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading