#<134>
import sys
input = sys.stdin.readline
N = int(input())
A = []
for n in range(N):
    A.append(int(input()))
#print(A)
for n in range(N):
    x = A[n]
    A[n] = 0
    print(max(A))
    A[n] = x
    #print(A)