n=int(input())
list=[int(input()) for i in range(n)]
max = 0
for i in range(n):
    if(i == 0):
        max = list[1]
    else:
        max = list[0]
    count = 0
    for c in list:
        if(max < c and i != count):
            max = c
        count += 1
    print(max)
