n = int(input())
hoge = [int(input()) for i in range(n)]

max_list = []
for i in range(len(hoge)):
    temp = hoge.copy()
    del temp[i]
    max_value = max(temp)
    max_list.append(max_value)
for i in max_list:
    print(i)