def returnmax(numbers, i, N):
    nowmax = 0
    for j in range(N):
        if j != i:
            if nowmax < numbers[j]:
                nowmax = numbers[j]
    return nowmax
    
numbers = []
N = int(input())
for i in range(N):
    numbers.append(int(input()))
for i in range(N):
    print(returnmax(numbers, i, N))
