init_seq = []
length = int(input())
def seq_f():
  for n in range(length):
      num = int(input())
      init_seq.append(num)
  return init_seq
init_seq = seq_f()
for n in range(length):
    seq = init_seq[:]
    del seq[n]
    seq = list(set(seq))
    seq.sort()
    print(seq[-1])

