N = int(input())
list_A = []

for _ in range(N):
    A = int(input())
    list_A.append(A)
    
for i in range(N):
    original = list_A[i]
    list_A[i] = 0
    print(max(list_A))
    list_A[i] = original