N = int(input())
D = [0 for i in range(0, N)]
for i in range(0, N):
    D[i] = int(input())

l = []
for i in range(N):
    d = D.copy()
    d.pop(i)
    l.append(max(d))
    
for i in range(len(l)):
    print(l[i])