import copy
n=input()
n=int(n)
A=[]
for i in range(n):
  A.append(input())
a=[int(j) for j in A]
a_copy=copy.deepcopy(a)
answer=[]
for i in range(n):
  a.pop(i)
  answer.append(max(a))
  a=copy.deepcopy(a_copy)
print(answer)