~/algor $ cat problems/minmax-40-har-biridan-boshqalar-maksimumi
Maximum of the others for each
Medium
1000 ms
128 MB
66%
A positive integer $N$ and $N$ integers are given. For every $i$ ($1 \le i \le N$), find the largest of all elements except $A_{i}$.
Input
The first line contains a positive integer $N$. The next line contains $N$ integers $A_{i}$.
Output
One line with $N$ integers separated by spaces: the answers for $i = 1, 2, \ldots, N$.
Note
$2 \le N \le 10^{5}$
$-10^{9} \le A_{i} \le 10^{9}$
Examples
Input #1
5 4 9 2 6 3
Output #1
9 6 9 9 9
Input #2
2 -7 5
Output #2
5 -7