'use strict'
const main = (input: string) => {
    const std: number[] = input.trim().split('\n').map(Number)
    const n: number = std.shift()
    const a: number[] = std
    let r: number[] = [];
    for (let i = 0; i < n; i++) {
        r.push(a.filter((val, index) => i !== index).reduce((a, b) => Math.max(a, b)))
    }
    console.log(r.join('\n'))
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
