n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
for j in range(n):
    ma=0
    for h in range(n):
        if(h!=j):
            if(ma<a[h]):
                ma=a[h]
    print(str(ma))  
