import sys
sys.setrecursionlimit(210000)
input = sys.stdin.readline

N = int(input())
A = [int(input()) for i in range(N)]
Ad = [0] *N

for i in range(N):
    tmp = A[i]
    A[i] = 0
    print(max(A))
    A[i] = tmp