Interesting Sorting#10141

Interesting Sorting

1 second
64 megabytes
Medium

You are given an array of natural numbers. Your task is to sort this array in ascending order based on the sum of the digits of each number. If two numbers have the same digit sum, sort them in descending order by their value.

Input

The first line contains the integer ( ≤ ≤ 10^6), representing the number of natural numbers. The following lines each contain one natural number, with each number not exceeding 10^9.

Output

Print the sequence of numbers sorted according to the specified conditions.

Examples

Example 1

Loading
Loading