E. Old Cipher
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Pikard intercepted the Borg's encryption and a set of some numbers. He remembered how such messages are encrypted.

The keys are natural numbers rearranged in a specific order:

  1. The numbers are rearranged in ascending order of the reversed representation of the number: 300 is reversed to 3, 4030 to 304, 123 to 321.
  2. If the reversed representations of the numbers are equal, they are rearranged in descending order of their indices in the original array.

The recorded numbers are the keys in the encryption.

You need to help Pikard correctly restore the order of the numbers for decryption.

Input

The first line contains the number $$$N$$$ $$$(1 \le N \le 10^5)$$$ — the number of numbers in the set.

In the second line, there are $$$N$$$ integers $$$a_i$$$ $$$(1 \le a_i \le 10^9)$$$ — the $$$i$$$-th number from the set, separated by spaces.

Output

Output $$$N$$$ integers separated by spaces — the numbers from the set in the order for decryption.

Example
Input
10
10 31 41 3100 310 31000 43 54 1000 14
Output
1000 10 31000 310 3100 31 41 43 14 54