N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())
X = [0] * N
count = 0
max = 0
for i in range(N):
    for j in range(N):
        if j != i:
            if max < A[j]:
                max = A[j]
    X[i] = max
for i in range(N):
    print(X[i])