#abc134 c
n=int(input())
a=[]
for i in range(n):
    x=int(input())
    a.append(x)
for i in range(n):
    max_a=0
    for j in range(n):
        if i==j:
            continue
        if max_a<=a[j]:
            max_a=a[j]
    print(max_a)
