import copy

N = int(input())
A = []
for n in range(N):
    A.append(int(input()))
for i in range(N):
    Ai = copy.copy(A)
    Ai.remove(Ai[i])
    L = copy.copy(Ai)
    L.sort(reverse=True)
    print(L[0])