package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	nums := make([]int, n)
	for i := range nums {
		fmt.Scan(&nums[i])
	}

	for i := 0; i < len(nums); i++ {
		cp := make([]int, n)
		copy(cp, nums)
		cp[i] = 0
		sort.Sort(sort.IntSlice(cp))
		fmt.Println(cp[n-1])
	}
}
