fun main(args:Array<String>):Unit {
    val n = readLine()!!.toInt()
    val nums = readLine()!!.split(' ').map(String::toInt)
    val sorted = nums.sorted().toIntArray()
    val mid = sorted[n / 2 - 1]
    val midNext = sorted[n / 2]
    for (xi in nums){
        println(if (mid >= xi) midNext else mid)
    }
}