from itertools import combinations
import copy

n = int(input())
ls = [int(input()) for _ in range(n)]

def function(n,ls):
    array = copy.deepcopy(ls)
    array.pop(n)
    return max(array)
    
for i in range(n):
    print(function(i,ls))