import numpy as np

S = input()
N = int(S)

A = np.zeros([N])
A_temp = np.zeros([N])

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

max = 0

for i in range(N):
    A_temp = A
    A_temp[i] = 0
    for j in range(N):
        max_temp = A_temp[j]
        if max_temp > max:
            max = max_temp
    print(max)
