import numpy as np
N = int(input())
list = []

def select(i):
  s = []
  for j in range(N):
    if j != i :
      s.append(list[j])
      
  print(np.max(s))
     
for n in range(N):
  list.append(int(input()))
  
for i in range(N):
  select(i)