import copy

n = int(input())
a = []
a_bak = []
a_sorted = []

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

for i in range(n):
    a_bak = copy.copy(a)
    
    a_bak[i] = 0

    a_sorted = sorted(a_bak, reverse=True)

    print(a_sorted[0])