import copy

N = int(input())

input_list = []
tmplist = []

for i in range(N):
  input_list.append(int(input()))

for i in input_list:
  tmplist = copy.copy(input_list)
  tmplist.remove(i)
  print(max(tmplist))