import numpy as np

#n, d = map(int, input().split())
n= int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())

for i in range(n):
    ii = a[i]
    a[i]= 0
    m = max(a)
    a[i] = ii
    print(m)


