# -*- coding: utf-8 -*-
# 整数の入力
import copy

a = int(input())
nums = [0]*a

for i in range(a):
    nums[i] = int(input())
    
for j in range(a):
    thisnums = copy.deepcopy(nums)
    thisnums[j] = 0
    print(max(thisnums))