fun main(args: Array<String>) {

    val N = readLine()!!.toInt()

    val inputs = readLine()!!.split(" ").map { it.toInt() }
    val (lowMid, highMid) = inputs.sorted().subList(N / 2 - 1, N / 2 + 1)

    inputs.forEach {
        if (it <= lowMid) println(highMid)
        else println(lowMid)
    }
}