import sys

N = int(input())
num_line  =[]
for e in map(int, sys.stdin):
    num_line.append(e)
for i in range(N):
    save_num = num_line[i]
    num_line.pop(i)
    print(max(num_line))
    num_line.insert(i, save_num)