fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val xx = readLine()!!.split(" ").map { it.toInt() }
    val xxs = xx.sorted()

    val m1 = xxs[(n/2)-1]
    val m2 = xxs[n/2]

    println(xx.map { if (it <= m1) m2 else m1 }.joinToString(separator = System.lineSeparator()))
}