
iN      =   int(input())
lA      =   []

for i in range(iN):
    iTmp    =   int(input())
    lA.append(iTmp)

for exception_num in range(iN):
    Max =   max(lA[0:exception_num] + lA[exception_num+1:])
    print(Max)