CodeEff/ECCO huggingface dataset:
# Original solution
N = int(eval(input()))
X = [int(x) for x in input().split()]

ind = [i for i in range(N)]
# XのindexをXが昇順になるように並び替える
ind = sorted(ind, key = lambda i : X[i])
ans = [0] * N
for i in range(N // 2):
    ans[ind[i]] = X[ind[N // 2]]
for i in range(N // 2, N):
    ans[ind[i]] = X[ind[N // 2 - 1]]

for i in range(N):
    print((ans[i]))

# Optimized solution
N = int(eval(input()))
X = [int(x) for x in input().split()]

Y = sorted(X)
for i in range(N):
    if X[i] < Y[N // 2]:
        print((Y[N // 2]))
    else:
        print((Y[N // 2 - 1]))
# Original solution
def main():
    n = int(eval(input()))
    num_list = list(map(int, input().split()))

    num_list_copy = num_list[:]

    num_list.sort()

    s_num_list = num_list[:]

    for i in range(n):
        num_list.remove(num_list_copy[i])
        print((num_list[(n-2)//2]))
        num_list = s_num_list[:]

if __name__ == '__main__':
    main()

# Optimized solution
def main():
    n = int(eval(input()))
    num_list = list(map(int, input().split()))

    c_num_list = num_list[:]

    num_list.sort()

    for i in range(n):
        tmp = num_list[n//2]
        if c_num_list[i] >= tmp:
            print((num_list[n//2-1]))
        else:
            print((num_list[n//2]))
        

if __name__ == '__main__':
    main()
# Original solution
# -*- coding: utf-8 -*-
N = int(eval(input()))
xn = list(map(int, input().split()))
xn_sorted = sorted(xn)

for xi in xn:
    xn_tmp = list(xn_sorted)
    xn_tmp.remove(xi)
    print((xn_tmp[(len(xn_tmp)+1)//2 -1]))


# Optimized solution
# -*- coding: utf-8 -*-
N = int(eval(input()))
xn = list(map(int, input().split()))
xn_sorted = sorted(xn)
val_a = xn_sorted[(len(xn_sorted))//2 - 1]
val_b = xn_sorted[(len(xn_sorted))//2]

for xi in xn:
    if xi <= val_a:
        print(val_b)
    else:
        print(val_a)
# Original solution
n = int(eval(input()))
x = list(map(int, input().split()))
t = sorted(x)
for i in range(n):
    j = t.index(x[i])
    s = t[:j] + t[j + 1:]
    print((s[n // 2 - 1]))

# Optimized solution
n = int(eval(input()))
x = list(map(int, input().split()))
t = sorted(x)
mid1, mid2 = t[n // 2 - 1], t[n // 2]
for i in range(n):
    if x[i] <= mid1:
        print(mid2)
    else:
        print(mid1)
# Original solution
N = int(eval(input()))
X = list(map(int, input().split()))

for i in range(len(X)):
    Y = X[:i] + X[i+1:]
    Y.sort()
    print((Y[int(N/2)-1]))

# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))
Y = sorted(X)

for i in range(len(X)):
    candi = Y[int(N/2)-1]
    if X[i] <= candi:
        print((Y[int(N/2)]))
    else:
        print(candi)
# Original solution
N = int(eval(input()))
X = list(map(int,input().split()))

for i in range(N):
    X_1 = X[:i] + X[i+1:]
    X_1.sort()
    print((X_1[N//2-1]))

# Optimized solution
N = int(eval(input()))
X = list(map(int,input().split()))
Y = sorted(X)

a = Y[(N-1)//2]
b = Y[(N+1)//2]

for i in X:
    if i > a:
        print(a)
    else:
        print(b)
# Original solution
n = int(eval(input()))
x = [int(i) for i in input().split()]
xs = sorted(x)
for i in range(n):
  xi = xs.copy()
  xi.remove(x[i])
  print((xi[n // 2 - 1]))

# Optimized solution
n = int(eval(input()))
x = [int(i) for i in input().split()]
xs = sorted(x)
d = dict()
for i in range(n):
  if xs[i] not in d:
    d[xs[i]] = i
for i in range(n):
  print((xs[n // 2 - int(d[x[i]] >= n // 2)]))
# Original solution
N = int(eval(input()))
X = list(map(int, input().split()))
Y = sorted(X)
A = []
for i in range(N):
    j = Y.index(X[i])
    A.append((Y[:j] + Y[j+1:])[(N-1)//2])
print(('\n'.join(map(str, A))))

# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))
Y = sorted(X)
l, r = Y[N//2-1], Y[N//2]
A = []
for i in range(N):
    if X[i] <= l:
        A.append(r)
    else:
        A.append(l)
print(('\n'.join(map(str, A))))
# Original solution
# See:
# https://qiita.com/suecharo/items/30f5d817da4c948c3be6
def merge_sort(arr):
    if len(arr) <= 1:
        return arr

    mid = len(arr) // 2
    # ここで分割を行う
    left = arr[:mid]
    right = arr[mid:]

    # 再帰的に分割を行う
    left = merge_sort(left)
    right = merge_sort(right)

    # returnが返ってきたら、結合を行い、結合したものを次に渡す
    return merge(left, right)


def merge(left, right):
    merged = []
    l_i, r_i = 0, 0

    # ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
    while l_i < len(left) and r_i < len(right):
        # ここで=をつけることで安定性を保っている
        if left[l_i] <= right[r_i]:
            merged.append(left[l_i])
            l_i += 1
        else:
            merged.append(right[r_i])
            r_i += 1

    # 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
    if l_i < len(left):
        merged.extend(left[l_i:])
    if r_i < len(right):
        merged.extend(right[r_i:])
    return merged


if __name__ == '__main__':
    n = int(eval(input()))
    x = list(map(int, input().split()))
    order = list(x)

    for i in range(n):
        tmp = order[i]
        x.remove(tmp)
        x = merge_sort(x)
        print((x[(n // 2) - 1]))
        x += [tmp]


# Optimized solution
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem C

if __name__ == '__main__':
    n = int(eval(input()))
    x = list(map(int, input().split()))
    sorted_x = sorted(x)

    low = sorted_x[(n // 2) - 1]
    high = sorted_x[(n // 2)]

    for i in range(n):
        if x[i] < high:
            print(high)
        else:
            print(low)
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
for i in range(len(a)):
  b=a.copy()
  del b[i]
  b.sort()
  print((b[(len(a)//2)-1]))

# Optimized solution
n,a=int(eval(input())),list(map(int,input().split()))
b=sorted(a[:])
x,y=b[n//2-1],b[n//2]
for i in a:print((x if i>x else y))
# Original solution
import statistics
n = int(eval(input()))-1
a = list(map(int, input().split()))
N = sorted([[x,y] for y, x in enumerate(a)])

ans = [0] * (n+1)
for i in range(n+1):
    if i < n//2+1: 
        ans[N[i][1]] = N[n//2+1][0]
    else: ans[N[i][1]] = N[n//2][0]
for x in ans: print(x)

# Optimized solution
n = int(eval(input()))
x = list(enumerate(map(int, input().split())))
x.sort(key=lambda x:x[1])
ans = [""]*n
for i in range(n):
  if (n+1)//2 >= i+1: ans[x[i][0]] = x[(n+1)//2][1]
  else: ans[x[i][0]] = x[(n+1)//2-1][1]

print(("\n".join(map(str, ans))))
# Original solution
import statistics
n = int(eval(input()))
x = list(map(int, input().split()))
for i in range(n):
    print((statistics.median(x[:i]+x[i+1:])))

# Optimized solution
n = int(eval(input()))
x = list(enumerate(map(int, input().split())))
x.sort(key=lambda x:x[1])
ans = [""]*n
for i in range(n):
  if (n+1)//2 >= i+1: ans[x[i][0]] = x[(n+1)//2][1]
  else: ans[x[i][0]] = x[(n+1)//2-1][1]

print(("\n".join(map(str, ans))))
# Original solution
n = int(eval(input()))
x = list(enumerate(map(int, input().split())))
x.sort(key=lambda x:x[1])
ans = [""]*n
for i in range(n):
  if (n+1)//2 >= i+1: ans[x[i][0]] = x[(n+1)//2][1]
  else: ans[x[i][0]] = x[(n+1)//2-1][1]

print(("\n".join(map(str, ans))))

# Optimized solution
n = int(eval(input()))
X = list(map(int, input().split()))
x = sorted(X)
l = x[n//2-1]
r = x[n//2]
for i in range(n):
    if X[i] <= l:
        print(r)
    else:
        print(l)
# Original solution
n = int(eval(input()))
x = list(map(int, input().split()))
X = sorted(x)

for i in x:
    I = X.index(i)
    l,r = I, n-I
    if I+1 <= n//2:
       print((X[I+n//2-l]))
    else:
        print((X[n//2-1]))

# Optimized solution
n = int(eval(input()))
X = list(map(int, input().split()))
x = sorted(X)
l = x[n//2-1]
r = x[n//2]
for i in range(n):
    if X[i] <= l:
        print(r)
    else:
        print(l)
# Original solution
#ABC 094 Many Medians

numbers=int(eval(input()))
list_num=[int(i) for i in input().split()]
sorted_list=sorted(list_num)

median1=sorted_list[int(numbers/2)-1]
median2=sorted_list[int(numbers/2)]

for i in list_num:
    if sorted_list.index(i) <= numbers/2-1:
        print(median2)
    else:
        print(median1)

# Optimized solution
numbers=int(eval(input()))
list_num=[int(i) for i in input().split()]
sorted_list=sorted(list_num)

median1=sorted_list[int(numbers/2)-1]
median2=sorted_list[int(numbers/2)]

for i in list_num:
    if i <= median1:
        print(median2)
    else:
        print(median1)
# Original solution
import statistics
N = int(eval(input()))
X = list(map(int, input().split()))
for i in range(N):
    print((statistics.median(X[0:i]+X[i+1:N])))

# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))
t = sorted(X)

for i in range(N):
    if X[i] <= t[N // 2 - 1]:
        print((t[N//2]))
    else:
        print((t[N//2-1]))
# Original solution
n = int(eval(input()))
x = list(map(int, input().split()))
for i in range(n):
    w = x[:i] + x[i+1:]
    w.sort()
    print((w[((len(w)+1)//2)-1]))

# Optimized solution
n = int(eval(input()))
x = list(map(int, input().split()))
w = tuple(x)
x.sort()
if x[(n//2)-1] == x[n//2]:
    for i in range(n):
        print((x[n//2]))
else:
    for h in w:
        if h <= x[(n//2)-1]:
            print((x[n//2]))
        else:
            print((x[(n//2)-1]))
# Original solution
n=int(eval(input()))
x=list(map(int,input().split()))
m=n//2 - 1
for i in range(n):
  a=sorted(x[:i]+x[i+1:])
  print((a[m]))

# Optimized solution
n=int(eval(input()))
x=list(map(int,input().split()))
arr=sorted(x)[n//2-1:n//2+1]
for i in range(n):
  if x[i]<=arr[0]:
    print((arr[1]))
  elif x[i]>=arr[1]:
    print((arr[0]))
# Original solution
import statistics
n = int(eval(input()))
x = [int(x) for x in input().split()]

#m = (n // 2) - 1
for i in range(n):
    l = x[:i] + x[i+1:]
#    l.sort()
    print((statistics.median(l)))
    #print(l[m])

# Optimized solution
n = int(eval(input()))
x = [int(x) for x in input().split()]

s = sorted(x)

for i in range(n):
    if x[i] <= s[n//2 - 1]:
        print((s[n//2]))
    else:
        print((s[n//2 - 1]))
# Original solution
#                         author:  kagemeka 
#                         created: 2019-11-07 11:52:43(JST)
import sys
# import collections
# import math
# import string
import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator

def main():
    n, *x = (int(i) for i in sys.stdin.read().split())
    s_x = list(sorted(x))
    half = n // 2
    m_s, m_l = s_x[half -1], s_x[half]
    for i in x:
        b = bisect.bisect_left(s_x, i)
        print((m_l if b < half else m_s))

if __name__ == "__main__":
    # execute only if run as a script
    main()


# Optimized solution
#                         author:  kagemeka 
#                         created: 2019-11-07 11:52:43(JST)
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator

def main():
    n, *x = (int(i) for i in sys.stdin.read().split())
    s_x = list(sorted(x))
    half = n // 2
    m_s, m_l = s_x[half - 1], s_x[half]
    for i in x:
        print((m_l if i < m_l else m_s))

if __name__ == "__main__":
    # execute only if run as a script
    main()
# Original solution
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output


def chkprint(*args):
    names = {id(v): k for k, v in list(inspect.currentframe().f_back.f_locals.items())}
    print((', '.join(names.get(id(arg), '???')+' = '+repr(arg) for arg in args)))

# Binary converter


def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]

# --------------------------------------------


dp = None


def main():
    N = int(eval(input()))
    X = li_input()

    sX = sorted(X)

    for x in X:
        if sX.index(x) < len(sX) // 2:
            print((sX[len(sX) // 2]))
        else:
            print((sX[len(sX) // 2 - 1]))


main()


# Optimized solution
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output


def chkprint(*args):
    names = {id(v): k for k, v in list(inspect.currentframe().f_back.f_locals.items())}
    print((', '.join(names.get(id(arg), '???')+' = '+repr(arg) for arg in args)))

# Binary converter


def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]

# --------------------------------------------


dp = None


def main():
    N = int(eval(input()))
    X = li_input()

    sX = sorted(X)
    med = sX[len(sX) // 2]
    med_min = sX[len(sX) // 2 - 1]

    for x in X:
        if x < med:
            print(med)
        else:
            print(med_min)


main()
# Original solution
n = int(eval(input()))
x = list(map(int, input().split()))

for i in range(n):
    tmp = x[:i]+x[i+1:]
#     print(tmp)
    print((sorted(tmp)[(n-1)//2]))    

# Optimized solution
n = int(eval(input()))
x = list(map(int, input().split()))

x_s = sorted(x)
med2 = x_s[n//2]
med1 = x_s[n//2-1]
for i in range(n):
    if x[i]<=med1:
        print(med2)
    else:
        print(med1)
# Original solution
import math
import statistics
N=int(eval(input()))
X=input().split()
Y=[int(a) for a in X]
Z=tuple(Y)
for a in range(N):
    b=Z[a]
    answer=list(Z)
    answer.remove(b)
    answer=sorted(answer)
    print((answer[int(N/2-1)]))


# Optimized solution
N=int(eval(input()))
X=input().split()
Y=[int(a) for a in X]
Z=sorted(Y)
a=Z[int(N/2-1)]
b=Z[int(N/2)]
for c in range(N):
    if Y[c]<=a:
        print(b)
    else:
        print(a)
# Original solution
N = int(eval(input()))
lst = list(map(int, input().split()))

a = sorted(lst)
center_m = a[N//2 - 1]
center_p = a[N//2]

#print (center_m, center_p)

for i in lst:
    if i <= center_m:
        print (center_p)
    else:
        print (center_m)

# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))

X_sort = sorted(X)

tmp_m = X_sort[N // 2 - 1]
tmp_p = X_sort[N // 2]

for x in X:
    if x <=tmp_m:
        print (tmp_p)
    else:
        print (tmp_m)
# Original solution
import copy

n = int(eval(input()))
x = [int(i) for i in input().split()]
sortedx = copy.copy(x)
sortedx.sort()

m = {}

for i in x:
    if i in m:
        print((m[i]))
    else:
        cnt = 0
        flag = False
        for j in range(n):
            if i == sortedx[j] and not flag:
                flag = True
            elif cnt == (n/2)-1:
                print((sortedx[j]))
                m[i] = sortedx[j]
                break
            else:
                cnt += 1      


# Optimized solution
import copy

n = int(eval(input()))
x = [int(i) for i in input().split()]
sortedx = copy.copy(x)
sortedx.sort()

m = sortedx[int((n+1)/2)]

for i in x:
    if i < m:
        print((sortedx[int(n/2)]))
    else:
        print((sortedx[int(n/2-1)]))
# Original solution
import copy

n = int(eval(input()))
x = [int(i) for i in input().split()]
sortedx = copy.copy(x)
sortedx.sort()

m = sortedx[int((n+1)/2)]

for i in x:
    if i < m:
        print((sortedx[int(n/2)]))
    else:
        print((sortedx[int(n/2-1)]))

# Optimized solution
n = int(eval(input()))
x = [int(i) for i in input().split()]
sortedx = sorted(x)
r = sortedx[n//2]
l = sortedx[n//2-1]

for i in x:
    if i < r:
        print(r)
    else:
        print(l)
# Original solution

n = int(eval(input()))
x = list(map(int, input().split()))

for i in range(n):
    memo = x.pop(i)
    b = sorted(x)
    print((b[int(n/2) - 1]))
    x.insert(i, memo)

# Optimized solution
n = int(eval(input()))
x = list(map(int, input().split()))
b = sorted(x)
m_left = b[int(n//2) -1]
m_right = b[int(n//2)]

for i in range(n):
    if x[i] <= m_left:
        print(m_right)
    elif x[i] >= m_right:
        print(m_left)
# Original solution
n = int(eval(input()))
x = list(map(int, input().split()))
def median(L):
    L = sorted(L)
    n = len(L)
    m = int(n/2)
    if n % 2 == 0:
        return (L[m - 1] + L[m]) / 2
    else:
        return L[(n - 1) // 2]
x_median = median(x)
l = median(sorted(x)[:-1])
r = median(sorted(x)[1:])
for i in range(n):
    if x[i] > x_median:
        print(l)
    else:
        print(r)

# Optimized solution
n = int(eval(input()))
x = list(map(int, input().split()))
x_sort = sorted(x)
def median(L):
    #L = sorted(L)
    n = len(L)
    m = int(n/2)
    if n % 2 == 0:
        return (L[m - 1] + L[m]) / 2
    else:
        return L[(n - 1) // 2]
x_median = median(x_sort)
l = median(x_sort[:-1])
r = median(x_sort[1:])
for i in range(n):
    if x[i] > x_median:
        print(l)
    else:
        print(r)
# Original solution
import sys
import statistics
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(eval(input()))
X = list(map(int, input().split()))
mid = N // 2 - 1

for i in range(N):
    print((statistics.median(X[:i]+X[i+1:])))


# Optimized solution
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(eval(input()))
X = list(map(int, input().split()))
X_sorted = sorted(X)
L = X_sorted[N//2-1]
R = X_sorted[N//2]


for x in X:
    print((L if x >= R else R))
# Original solution
import copy
import statistics
n = int(eval(input()))
x = [int(y) for y in input().split()]
z = copy.deepcopy(x)

for i in range(n):
  x.pop(i)
  print((statistics.median(x)))
  x.insert(i, z[i])

# Optimized solution
import copy
import statistics
n = int(eval(input()))
x = [int(y) for y in input().split()]
z = copy.deepcopy(x)
z.sort()
t = (z[int(n / 2) - 1] + z[int(n / 2)]) / 2

for i in range(n):
  if x[i] < t:
    print((z[int(n / 2)]))
  else:
    print((z[int(n / 2) - 1]))
# Original solution
import sys
import copy


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return list(map(int, stdin.readline().split()))
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    X = nl()
    X_s = sorted(X)
    for i in range(n):
        X_s_c = copy.copy(X_s)
        X_s_c.remove(X[i])
        print((X_s_c[(n - 1) // 2]))


if __name__ == '__main__':
    main()


# Optimized solution
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return list(map(int, stdin.readline().split()))
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    X = nl()
    X_s = sorted(X)
    mid = X_s[n // 2]
    del_mid = (X_s[:n // 2] + X_s[n // 2 + 1:])[(n - 1) // 2]
    for x in X:
        if x < mid:
            print(mid)
        elif x > mid:
            print((X_s[n // 2 - 1]))
        else:
            print(del_mid)


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
X = list(map(int, input().split()))
for i in range(n):
    if i !=0 and i != n-1:
        l = X[:i] + X[i+1:]
    elif i == 0:
        l = X[1:]
    else:
        l = X[:n-1]
    l.sort()
    print((l[n // 2 - 1]))


# Optimized solution
n = int(eval(input()))
X = list(map(int, input().split()))
X_mid = sorted(X)[n//2 - 1: n//2 + 1]

for i in X:
    print((X_mid[i <= X_mid[0]]))  # Falseなら1、Trueなら0
# Original solution
# input
N = int(eval(input()))
X = list(map(int, input().split()))

# check
center = N // 2 - 1
for ind in range(N):
    if ind == 0:
        target = X[1:]
    elif ind == N - 1:
        target = X[:ind]
    else:
        target = X[:ind] + X[ind + 1:]
    target.sort()

    print((target[center]))

# Optimized solution
# input
N = int(eval(input()))
X = list(map(int, input().split()))

# check
l, r = N // 2 - 1, N // 2
sort_x = sorted(X)
lx, rx = sort_x[l], sort_x[r]

if lx == rx:
    for i in range(N):
        print(lx)
else:
    for ind in range(N):
        target = X[ind]
        if target <= lx:
            print(rx)
        if target >= rx:
            print(lx)
# Original solution
from statistics import median
from operator import itemgetter
N = int(eval(input()))
x = list(map(int, input().split()))
y = [x for x in range(N)]
z = list(zip(x, y))
z.sort()
x_, y = list(zip(*z))
val = N//2

for i in range(N):
    if list(y).index(i) < val:
        print((x_[val]))
    else:
        print((x_[val-1]))



# Optimized solution
from statistics import median
from operator import itemgetter
N = int(eval(input()))
x = list(map(int, input().split()))
x_ = sorted(x)
m0 = median(x_[1:])
m1 = median(x_[:-1])
for i in x:
    if m1 >= i:
        print(m0)
    else:
        print(m1)
# Original solution
n = int(eval(input()))
x = [int(i) for i in input().split()]
for i in range(n):
    y = x[:i]+x[i+1:]
    y_new = sorted(y)
    print((y_new[n//2-1]))

# Optimized solution
n = int(eval(input()))
x = [int(i) for i in input().split()]
x_new = sorted(x)
med1 = x_new[n//2]
med2 =x_new[n//2-1]
for i in range(n):
    if x[i] < med1:
        print(med1)
    else:
        print(med2)
# Original solution
N = int(eval(input()))
X = list(map(int, input().split()))

argsort = [[x, i] for i, x in enumerate(X)]
argsort.sort()
argsort = [[i, j] for j, [_, i], in enumerate(argsort)]
argsort.sort()
ranks = [j + 1 for _, j in argsort]

indices = [[x, i] for i, x in enumerate(X)]
indices.sort()
indices = {(i + 1): x for i, (x, _) in enumerate(indices)}


median = N // 2
for i in range(0, N):
    r = ranks[i]
    if r <= median:
        print((indices[median + 1]))
    else:
        print((indices[median]))


# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))

argsort = [[x, i] for i, x in enumerate(X)]
argsort.sort()

indices = {(i + 1): x for i, (x, _) in enumerate(argsort)}

argsort = [[i, j] for j, [_, i], in enumerate(argsort)]
argsort.sort()

ranks = [j + 1 for _, j in argsort]

median = N // 2
for i in range(0, N):
    r = ranks[i]
    if r <= median:
        print((indices[median + 1]))
    else:
        print((indices[median]))
# Original solution
n = int(eval(input()))
xx = list(map(int, input().split()))
 
for i in range(n):
  yy = xx[:i] + xx[i+1:]
  zz = sorted(yy)
  print((zz[(n-1)//2]))

# Optimized solution
n = int(eval(input()))
xx = list(map(int, input().split()))
yy = sorted(xx)

a = yy[n//2-1]
b = yy[n//2]

for x in xx:
  if x <= a:
    print(b)
  elif x >= b:
    print(a)
# Original solution
from statistics import median
N = int(eval(input()))
X = list(map(int, input().split()))
for i in range(N): 
    Y = X[:i] + X[i+1:]
    print((median(Y)))

# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))
Y = sorted(X)
a = Y[N//2 - 1]
b = Y[N//2]
for i in range(N): 
    if X[i] <= a:
        print(b)
    else:
        print(a)
# Original solution
N = int(eval(input()))
X = list(map(int,input().split()))
sX = sorted(X)
tsX = sX[:]
k = int(N/2-1)
for i in range(N):
    tsX.remove(X[i])
    print((tsX[k]))
    tsX = sX[:]


# Optimized solution
N = int(eval(input()))
X = list(map(int,input().split()))
sX = sorted(X)
m1 = sX[int(N/2-1)]
m2 = sX[int(N/2)]
for i in X:
    if i<=m1:
        print(m2)
    else:
        print(m1)
# Original solution
import copy
N = int(eval(input()))
X = list(map(int, input().split()))
XX = sorted(X)
for i in range(N):
    delX = copy.copy(XX)
    delX.remove(X[i])
    # print(delX)
    print((delX[N // 2 - 1]))


# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))
Y = sorted(X)
for x in X:
    if x <= Y[N // 2 - 1]:
        print((Y[N // 2]))
    else:
        print((Y[N // 2 - 1]))
# Original solution
import sys
if __name__ == "__main__":
    N = int(eval(input()))
    X = list(map(int, (input().split(' '))))
    for i in range(N):
        buf = list(X)
        buf.pop(i)
        buf = sorted(buf)
        print((buf[int(N/2)-1]))

# Optimized solution
import sys
if __name__ == "__main__":
    N = int(eval(input()))
    X = list(map(int, (input().split(' '))))
    buf = sorted(X)
    for i in range(N):
#        buf = list(X)
#        buf.pop(i)
#        buf = sorted(buf)
#        print(X[i])
#        print(buf[int(N/2)])
        if X[i] < buf[int(N/2)]:
            print((buf[int(N/2)]))
        else:
            print((buf[int(N/2)-1]))