n=int(input())
lists=[]

for i in range(n):
    lists.append(int(input()))

for i in range(n):
    if i==0:
        newlist=lists[1:]
        print(max(newlist))
    if i>=1:
        newlist=lists[:i]+lists[i+1:]
        print(max(newlist))