n = int(input())
lst = []
for i in range(0,n):
  lst.append(int(input()))
  
ans = []
for i in range(0,len(lst)):
  sort_lst = lst[:]
  sort_lst.pop(i)
  sort_lst.sort(reverse=True)
  ans.append(sort_lst[0])
 
for d in ans:
  print(d)