"use strict"
function main(arg) {
    var data = arg.trim().split("\n").map(Number)
    data.shift()

    for (var i = 0; i < data.length; i++) {
        var arr1 = data.slice(0, i)
        var arr2 = data.slice(i + 1, data.length)
        // console.log([arr1])
        // console.log([arr2])
        // console.log('------')
        var m = Math.max(Math.max(...arr1), Math.max(...arr2))
        console.log(m)
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));