import sys
import copy
def input():
    return sys.stdin.readline()
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))

for i in range(n):
  tmp = copy.copy(a)
  tmp[i] = 0
  print(max(tmp))
  #print(tmp)