n = int(input())
lst = []
for i in range(0,n):
  lst.append(int(input()))
  

for i in range(0,len(lst)):
  sort_lst = []
  for j in range(0,len(lst)):
    if not i == j:
      sort_lst.append(lst[j])
  sort_lst = sorted(sort_lst, reverse=True)
  print(sort_lst[0])