n = int(input())
columns = [int(input()) for i in range(n)]
maximum_keeper=[]
for order_element in range(0,len(columns)):
    copied=columns.copy()
    copied.pop(order_element)
    print(max(copied))