
N=int(input())
a=[0]*N
maxim=0
for i in range(N):
    a[i]=int(input())
for j in range(N):
    for k in range(N):
        if a[j]!=a[k]:
            if a[k]>maxim:
                maxim=a[k]
    print(maxim)
    maxim=0