N=int(input())
AList = [int(input()) for i in range(N)]

MList=[]
i=0
while i<N:
    B=str(AList[i])
    AList[i]=0
    MList.append(max(AList))
    AList[i]=int(B)
    
    i+=1

for i in MList:
    print(i)