#n,k = list(map(int,input().split(" ")))
"""n = int(input())
print(3*(n*n))
"""
"""
import math as m
N,D = list(map(int,input().split(" ")))
print(m.ceil(N / (2*D+1)))
"""
N = int(input())
l = []
nums = []
for i in range(N):
    Ai = int(input())
    nums.append(Ai)
    l.append(Ai)
for i in range(N):
    new = l.copy()
    new.remove(nums[i])
    print(max(new))