import copy

N = int(input())

x_list = []
for i in range(N):
    x = int(input())
    x_list.append(x)

for i in range(len(x_list)):
    tmp_list = copy.deepcopy(x_list)
    tmp_list.pop(i)
    print(max(tmp_list))