Skip to main content
LIVE CONTEST: Round #7 · Begin Marathon is live now! …

~/algor $ cat problems/minmax/maximum-of-the-others-for-each

Maximum of the others for each

Author Iqbolshoh Ilhomjonov 3 @iqbolshoh 650 problems
Medium 1000 ms 128 MB 66%
Share

A positive integer and integers are given. For every (), find the largest of all elements except .

For every element, the largest of the other elements is written down

Input

The first line contains a positive integer . The next line contains integers .

Output

One line with integers separated by spaces: the answers for .

Note


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

Sign in to submit a solution

Signing up is free and takes a minute.