There are n candidates (n >= 2), each with a given score. For every candidate, output the maximum score among all other candidates - excluding only that candidate's own position, even if another candidate elsewhere shares the same value. Print the n resulting values, space separated, in the original candidate order.
Input format
Line 1: an integer n.
Line 2: n space-separated integers, the scores.
Output format
n space-separated integers: for each position i, the maximum score among all positions other than i.
Constraints
- 2 <= n <= 100000
- -1000000 <= score <= 1000000