fun main(args: Array<String>) {
    val aList = List(readLine()!!.toInt()) {
        readLine()!!.toInt()
    }

    repeat(aList.size) {
        val tempList = aList.toMutableList()
        tempList.removeAt(it)
        println(tempList.max())
    }
}
