import sys

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

list =[]  
for i in range(N):
    for j in range(N):
        if(j != i):
            list.append(numbers[j])
            
    print(max(list))
    list.clear()