import copy

N = int(input())
A_list= []

for _ in range(N):
    A_list.append(int(input()))

for i, a in enumerate(A_list):
    temp_A_list = copy.copy(A_list)
    temp_A_list.pop(i)
    print(max(temp_A_list))