N=int(input())
A=list(range(N))
S=list(range(N-1))

for i in range(N):
    A[i]=int(input())

for i in range(N):
    r=0
    for j in range(N):
     if j!=i:
       if A[j]>r:
          r=A[j]

    print(r)