import copy
n=int(input())
list=[int(input()) for i in range(n)]
max = 0
for i in range(n):
    temp_list = copy.copy(list)
    temp_list.pop(i)
    temp_list.sort(reverse=True)
    print(temp_list[0])