Spaceship
InterviewTime limit2sMemory limit1024 MB
Given n enemy strengths, find the boss, which equals the sum of the others, and print the order that destroys it last.
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 enemies has strength . 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 , the number of enemies ().
The second line contains integers , the strength of each enemy (). The strengths are given in random order.
Output
Print the values 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.