void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n; rd(n);
  auto a=readln.split.to!(int[]);

  import std.typecons;
  alias T=Tuple!(int, "val", int, "id");
  auto data=new T[](n);
  foreach(int i; 0..n) data[i]=T(a[i], i);
  sort!"a.val<b.val"(data);

  auto med=new int[](n);
  int ml=data[n/2-1].val, mr=data[n/2].val;
  foreach(i; 0..n){
    if(i<n/2) med[data[i].id]=mr;
    else med[data[i].id]=ml;
  }

  writefln("%(%s\n%)", med);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}
