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.
The first line contains number , and next lines contain the positive integers not greater than .
Print the sequence of numbers ordered as given in problem statement.