import math

N = int(input())

numbers_full = []
for _ in range(N):
  numbers_full.append(int(input()))

for i in range(N):
  numbers_minus1 = numbers_full.copy()
  numbers_minus1[i] = 0
  print(str(max(numbers_minus1)))