import math
import copy
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
#修正ver
X = [0] * N
for i in range(N):
    B = copy.copy(A)
    del B[i]
    max = max(B)
    X[i] = max
for i in range(N):
    print(X[i])
