package main

import (
	"fmt"
	"math"
)

func max(nums []int) (res int) {
	res = nums[0]
	for _, v := range nums {
		res = int(math.Max(float64(res), float64(v)))
	}
	return
}

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

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	for i := 0; i < n; i++ {
		tmp := a[i]
		a[i] = 0
		fmt.Println(max(a))
		a[i] = tmp
	}
}
