import copy
import sys
def input():
    return sys.stdin.readline()[:-1]
  

n=int(input())
num_list=[int(input()) for i in range(n)]
 
buf = []
 
for i in range(n):
  buf = copy.copy(num_list)
  buf.pop(i)
  print(max(buf))