output_description: Print N lines. The i-th line should contain B_i.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      X_1 X_2 ... X_N
attempt: import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
  
  sys.setrecursionlimit(10**7)
  inf = 10**20
  eps = 1.0 / 10**10
  mod = 10**9 + 7
  dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
  ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
  
  
  def LI():
      return [int(x) for x in sys.stdin.readline().split()]
  
  
  def LI_():
      return [int(x) - 1 for x in sys.stdin.readline().split()]
  
  
  def LF():
      return [float(x) for x in sys.stdin.readline().split()]
  
  
  def LS():
      return sys.stdin.readline().split()
  
  
  def I():
      return int(sys.stdin.readline())
  
  
  def F():
      return float(sys.stdin.readline())
  
  
  def pf(s):
      return print(s, flush=True)
  
  
  N = I()
  X = LI()
  
  #  N = 200000
  #  X = [i*10 for i in range(1,N+1)]
  
  """
  まずは偶数時の中央値のidxを求める
  偶数時の中央値より小さいものが抜かれたときは、そのまま、
  大きいものが抜かれたときはidx-1が中央値となる
  """
  # 見つかったメディアンを保存
  found = {}
  sorted_X = sorted(X)
  median = sorted_X[int(len(X) / 2)]
  for x in X:
      #  print('x', x)
      #  print('found', found)
      if x < median:
          if found.get("small", None):
              print(found["small"])
          else:
              print(median)
              found["small"] = median
      elif x > median:
          if not found.get("big", None):
              tmp = [i for i in sorted_X]
              tmp.remove(x)
              # 奇数長になっている
              m = tmp[int(len(tmp) // 2 + 1)]
              print(m)
              found["big"] = m
          else:
              print(found["big"])
      else:
          if not found.get("equal", None):
              tmp = [i for i in sorted_X]
              tmp.remove(x)
              m = tmp[int(len(tmp) // 2)]
              print(m)
              found["equal"] = m
          else:
              print(found["equal"])
  
problem_description: Statement
  
  When l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the
  (\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l.
  
  You are given N numbers X_1, X_2, ..., X_N, where N is an even number. For
  each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i,
  that is, the median of X_1, X_2, ..., X_{i-1}, X_{i+1}, ..., X_N be B_i.
  
  Find B_i for each i = 1, 2, ..., N.
samples: [{"input": "4\n    2 4 4 3", "output": "4\n    3\n    3\n    4\n    \n\n  * Since the median of X_2, X_3, X_4 is 4, B_1 = 4.\n  * Since the median of X_1, X_3, X_4 is 3, B_2 = 3.\n  * Since the median of X_1, X_2, X_4 is 3, B_3 = 3.\n  * Since the median of X_1, X_2, X_3 is 4, B_4 = 4.\n\n* * *"}, {"input": "2\n    1 2", "output": "2\n    1\n    \n\n* * *"}, {"input": "6\n    5 5 4 4 3 3", "output": "4\n    4\n    4\n    4\n    4\n    4"}]