Tricky Sorting#1462

Tricky Sorting

1 second
128 megabytes
Easy

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.

Input

The first line contains the number n~(1 \le n \le 100), and the second line contains positive integers, each not greater than .

Output

Print the sequence of numbers sorted according to the described rules.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading