n = int(input())
num_list = []
for _ in range(n):
    num_list.append(int(input()))

ans_list = []
for i in range(n):
    tmp = num_list.copy()
    tmp = tmp[:i] + tmp[i+1:]
    tmp.sort()
    maximum = tmp[-1]
    ans_list.append(maximum)

for j in ans_list:
    print(j)