n = int(input())
li = []
for i in range(n):
    number = int(input())
    li.append(number)
temp = []
for i in range(n):
    for j in range(len(li)):
        if i != j:
            temp.append(li[j])
        else:
            temp.append(0)
d = 0
for i in range(n):
    max_num = 0
    for j in range(n):
        if max_num<=temp[d]:
            max_num = temp[d]
        d+=1
    print(max_num)
    