fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = (1..n).map {
        readLine()!!.toInt()
    }
    fun solve(i: Int): Int {
        var min = 9999999
        for (j in 0 until a.size) {
            if (i == j) continue
            min = Math.min(a[j], min)
        }
        return min
    }
    for(i in 0 until n) {
        println(solve(i))
    }
}
