# -*- coding: utf-8 -*-
import copy

# input
N = int(input())
A = list()
for _ in range(N):
    A.append(int(input()))

# solve & output
for i in range(N):
    tmp = copy.copy(A)
    del tmp[i]
    print(max(tmp))
