n = int(input())
a = []
a_sorted = []
tmp = 0

for i in range(n):
    a.append(int(input()))

for i in range(n):
    
    tmp = a[i]
    a[i] = 0

    a_sorted = sorted(a, reverse=True)

    a[i] = tmp
    
    print(a_sorted[0])
