//添字付mergeSort
'use strict'
function mergeSort(arr){
  var groups=[[]];
  var n=0;
  for(let i=0;i<arr.length;i++){
    groups[n].push([arr[i],i]);
    if(arr[i]>arr[i+1]){
      n++;
      groups[n]=[];
    }
    
  }
  while(groups.length>1){//大
    let newGroups=[];
    while(groups.length>=2){//中
      let g1=groups.pop();
      g1.push([Infinity]);
      let g2=groups.pop();
      g2.push([Infinity]);
      let merged=[];
      let j=0,k=0;
      while(j<g1.length-1||k<g2.length-1){//小
        if(g1[j][0]<g2[k][0]){
          merged[j+k]=g1[j];
          j++;
        }else{
          merged[j+k]=g2[k];
          k++;
        }
      }//小了
      newGroups.push(merged);
    }//中了
    if(groups.length)
      newGroups.push(groups[0]);
    groups=newGroups;
  }//大了
  var result=groups[0];
  return result;
}

function Main(input){
  input=input.trim().split(/\s+/).map(x=>x-0);
  var N=input.shift();
  var sorted=mergeSort(input);
  var L=sorted[N/2-1][0];
  var H=sorted[N/2][0];
  var ans=[];
  for(let i=0;i<N/2;i++){
    let ID=sorted[i][1];
    ans[ID]=H;
  }
  for(let i=N/2;i<N;i++){
    let ID=sorted[i][1];
    ans[ID]=L;
  }
  console.log(ans.join('\n'));
}

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