Under construction

Still being built. Things may change

Spaceship

Interview

Time limit2sMemory limit1024 MB

Summary
Given n enemy strengths, find the boss, which equals the sum of the others, and print the order that destroys it last.
Level

Easy2 of 10

Topics
Array, Math
Solved
No attempts yet

Statement

On the way to saving the town of Angel Grove, Black Ranger Zack Taylor ran into another obstacle. He found himself on an alien spaceship surrounded by enemies, and to get free he must destroy all of them in a specific order.

Each of the nn enemies has strength fif_i. One of them is the boss, whose strength equals the sum of the strengths of all the others. Destroying the boss requires full concentration, so Zack can only face it after he has destroyed every other enemy.

Zack has little time left and cannot tell which enemy is the boss. Help him restore the order in which he must destroy the enemies to escape.

Input

The first line contains a natural number nn, the number of enemies (3≤n≤1053 \le n \le 10^5).

The second line contains nn integers fif_i, the strength of each enemy (−109≤fi≤109-10^9 \le f_i \le 10^9). The strengths are given in random order.

Output

Print the values fif_i on a single line in the order in which Zack destroys the corresponding enemies. If several orders are valid, print any of them.

It is guaranteed that a solution exists and that exactly one enemy can be the boss.

Examples2

  1. Example 1

    Input
    3
    2 5 3
    
    Expected output
    2 3 5
    
  2. Example 2

    Input
    5
    -1 1 0 1 -1
    
    Expected output
    -1 1 1 -1 0