N = int(input())
A = []
t = 0
for i in range(N):
    A.append(int(input()))
while t != N:
    B = [0] * N
    for i in range(N):
        if t != i:
            B[i] = A[i]
    print(max(B))
    t += 1
