object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val xs = Array.fill(n)(sc.nextInt())

  val ans = Array.fill(n)(-1)
  val (l, r) = xs.zipWithIndex.sortBy(_._1).splitAt(n/2)
  val ml = l.last._1
  val mr = r.head._1
  for ((_, idx) <- l) {
    ans(idx) = mr
  }

  for ((_, idx) <- r) {
    ans(idx) = ml
  }

  val pw = new java.io.PrintWriter(Console.out)
  ans.foreach(pw.println)
  pw.flush()
}
