import copy

n = int(input())
value_list = []

for i in range(n):
    value_list.append(int(input()))

for i in range(n):
    keep_list = copy.copy(value_list)
    keep_list[i] = 0
    print(max(keep_list))