import copy

N = int(input())
numbers = []
for i in range(N):
    numbers.append(int(input()))
    
for n in numbers:
    numbers_2 = copy.deepcopy(numbers)
    c = copy.deepcopy(n)
    numbers_2.remove(c)
    print(max(numbers_2))