import copy

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

for i in range(n):
    a_list.append(int(input()))
    
#print(a_list)    
for i in range(n):
    a_copy = copy.copy(a_list)
    a_copy.pop(i)
    #print(a_copy)
    print(max(a_copy))