import copy


def resolve():
    N = int(input())
    A = [int(input()) for i in range(N)]
    for i in range(N):
        B = copy.copy(A)
        B[i] = 0
        B.sort()
        print(B[-1])
        
        
resolve()