N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))


for i in range(len(S)):
        maax=-100
        for j in range(len(S)):
                if i==j:
                        continue
                if S[j] > maax:
                        maax = S[j]
        print(maax)