'use strict'
function main(input) {
  input = input.split(/\n|\s/).map(v => ~~v)
  const n = input.shift()
  const arr = input //.slice(1, n + 1)
  // let sorted = arr.slice(0)
  // mergeSort(sorted, 0, n) //arr.slice(0).sort((a, b) => a - b) //countingSort(arr)
  const sorted = [...arr].sort((a, b) => a - b) //countingSort(arr)
  const mid = sorted[n / 2]
  const mid2 = sorted[n / 2 - 1]
  // console.log(arr, sorted, mid)

  const ans = []
  for (let i = 0; i < n; i++) {
    if (arr[i] < mid) {
      ans.push(mid)
    } else {
      ans.push(mid2)
    }
  }
  console.log(ans.join('\n'))
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
