import copy
n = int(input())
ls = []
for i in range(n):
    a = int(input())
    ls.append(a) 
    
for i in range(len(ls)):
    ls2 = copy.copy(ls)
    del ls2[i]
    ls2 = sorted(ls2)
    print(ls2[-1])
    