N = int(input())

A = []
for i in range(N):
  tmp = int(input())
  A.append(tmp)
  
for i in range(N):
  tmp_list = A[:]
  tmp_list.pop(i)
  #print(tmp_list)
  tmp_set = set(tmp_list)
  print(max(tmp_set))