Sort by Absolute Value


Submit solution

Points: 100
Time limit: 2.0s
Memory limit: 256M

Author:
Problem types

Stably sort integers by increasing absolute value.

Input

The first line contains \(n\). The second line contains \(n\) integers.

The input satisfies:

  • \(0 <= n <= 1000\)

Output

Print the sorted values separated by spaces. Values with equal absolute value retain their input order.

Example

Input
5
-5 3 -2 1 2
Output
1 -2 2 3 -5

Comments

There are no comments at the moment.