N = int(input())
A = [0]*N
B = [0]*N

for i in range(N):
    A[i] = int(input())


for i in range(N):
    for j in range(N):
        if j != i:
            B[j] = A[j]
        else:
            B[j] = 0
    print(max(B))