object Main {

	def main(arg:Array[String]) = {
		val n = scala.io.StdIn.readLine().toInt;
		var list = scala.io.StdIn.readLine().split(" ").map(_.toInt);
  		list.reverse;

  		val sorted = list.sorted;
  		val left = sorted(sorted.size / 2 - 1);
  		val right = sorted(sorted.size / 2);

  		for (x <- list) {
  			if (x <= left) println(right);
  			else println(left);
  		}
	}
}

Main.main(null);