fun main (args:Array<String>){
    val seqLen = readLine()!!.toInt()
    val seqList = mutableListOf<Int>()
    for(i in 1..seqLen){
        seqList.add(readLine()!!.toInt())
    }
//    var num1 = 0
//    var num2 = 0
//    var num3 = 0
    val sortList = seqList.sorted()
//    val ansList = mutableListOf<Int>()
//    println(seqList)
//    println(sortList)
    for(i in 0..seqLen-1){
        val x = sortList.minus(seqList[i])
        val xx = x.max()!!
        println(xx)
    }
}