fun main(args: Array<String>) {
    val aArray = LongArray(readLine()!!.toInt()) {
        readLine()!!.toLong()
    }

    repeat(aArray.size) { i ->
        val tempList = aArray.toMutableList()
        tempList.remove(aArray[i])
        println(tempList.max())
    }
}
