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

def check_max_num(i,numbers):
    max_num = 0
    for j in range(len(numbers)):
        if j != i:
            if numbers[j] > max_num:
                max_num = numbers[j]
    return max_num

for i in range(len(numbers)):
    print(check_max_num(i,numbers))