n=int(input())
x=[]
for i in range(n):
  x.append(int(input()))
cnt = [0] * 10
for i in range(n):
  for j in range(n):
    if i is not j and cnt[i] < x[j]:
      cnt[i]=x[j]
for i in range(n):
  print(cnt[i])