import numpy as np
import copy

N = int(input())

num_list = []

for i in range(N):
  num = int(input())
  num_list.append(num)
    
for i in range(N):
  dummy_list = copy.copy(num_list)
  del dummy_list[i]
  print(np.amax(dummy_list))