N=input()
N=int(N)
A=[]
for i in range(N):
    b=input()
    b=int(b)
    A.append(b)
for i in range(N):
#    A=a
#    print(A)
    data=A.pop(i)

#    print(lst,i)
    print(max(A))
    A.insert(i,data)
