CodeEff/ECCO huggingface dataset:
# Original solution
n=int(eval(input()))
x=list(map(int,input().split()))
x.insert(0,0) #x[0]に0を挿入
sorted_x = sorted(x[:])

l,r=sorted_x[n//2],sorted_x[n//2+1]

for i in range(1,n+1):
    print((r if x[i]<=l else l))

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

sorted_a = sorted(a)

# 中央値を求める
med = [sorted_a[n // 2 - 1], sorted_a[n // 2]]


for i in range(n):
	if a[i] <= med[0]:
		print((med[1]))
	else:
		print((med[0]))
# Original solution
N = int(eval(input()))
X = list(map(int, input().split()))
sx = sorted(X)
lm = sx[N//2-1]
rm = sx[N // 2]
for i in range(N):
    if sx.index(X[i]) <= N//2 -1:
        print(rm)
    else:
        print(lm)


# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))
sx = sorted(X)
lm = sx[N//2-1]
rm = sx[N // 2]
for i in range(N):
    if X[i] <= lm:
        print(rm)
    else:
        print(lm)
# Original solution
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    X = il()
    S = sorted(X)
    for x in X:
        idx = S.index(x)
        if idx < N // 2:
            print((S[N // 2]))
        else:
            print((S[N // 2 - 1]))


if __name__ == '__main__':
    main()


# Optimized solution
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    X = il()
    S = sorted(X)
    l = S[N // 2 - 1]
    r = S[N // 2]
    for x in X:
        if x <= l:
            print(r)
        else:
            print(l)


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(a)
c = int(n/2)
for j in range(1,c):
    b.remove(max(b))
    b.remove(min(b))
ML = min(b)
MR = max(b)
for i in range(0,n):
    if a[i] >= MR:
        print(ML)
    else:
        print(MR)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(a)
b.sort()
c = int(n/2)
ML=b[c-1]
MR=b[c]
for i in range(0,n):
    if a[i] >= MR:
        print(ML)
    else:
        print(MR)
# Original solution
n = int(eval(input()))
x = list(map(int, input().split()))
x_sorted = sorted(x)

for i, num in enumerate(x):
    x_copy = x.copy()
    x_copy.pop(i)
    x_copy = sorted(x_copy)
    print((x_copy[len(x_copy) // 2]))

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

for num in x:
    if num <= target:
        print((x_sorted[n // 2]))
    else:
        print((x_sorted[n // 2 - 1]))
# Original solution
N = int(input())
X = list(map(int, input().split()))

mid1, mid2 = sorted(X)[N//2-1:N//2+1]
print(*[mid1 if xi>mid1 else mid2 for xi in X], sep="\n")


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

mid1, mid2 = sorted(X)[N//2-1:N//2+1]
print(('\n'.join(str(mid1) if xi>mid1 else str(mid2) for xi in X)))
# Original solution
N = int(eval(input()))
X = list(map(int, input().split()))

mid1, mid2 = sorted(X)[N//2-1:N//2+1]
print(('\n'.join(str(mid1) if xi>mid1 else str(mid2) for xi in X)))


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

mid1, mid2 = sorted(X)[N//2-1:N//2+1]
smid1 = str(mid1)
smid2 = str(mid2)
print(('\n'.join(smid1 if xi>mid1 else smid2 for xi in X)))
# Original solution
N = int(eval(input()))
X = list(map(int,input().split()))
A = sorted(X[:])
B = A[N//2-1]
for i in range(N):
    if X[i]>B:
        print(B)
    else:
        print((A[N//2]))

# Optimized solution
N = int(eval(input()))
X = list(map(int,input().split()))
Y = sorted(X[:])
Y1 = Y[N//2-1]
Y2 = Y[N//2]
for i in range(N):
    if X[i]>Y1:
        print(Y1)
    else:
        print(Y2)
# Original solution
N = int(eval(input()))
X = list(map(int,input().split()))
Y = sorted(X[:])
Y1 = Y[N//2-1]
Y2 = Y[N//2]
for i in range(N):
    if X[i]>Y1:
        print(Y1)
    else:
        print(Y2)

# Optimized solution
N = int(eval(input()))
X = list(map(int,input().split()))
X.insert(0,0)
A = sorted(X[:])
a = A[N//2]
b = A[N//2+1]
for i in range(1,N+1):
    if X[i]>a:
        print(a)
    else:
        print(b)
# Original solution
N = int(eval(input()))
X = list(map(int,input().split()))

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

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

mylist = sorted(X)
for i in range(N):
	ans = mylist[N//2-1]
	if X[i] > ans:
		print(ans)
	else:
		print((mylist[N//2]))
# Original solution
n=int(eval(input()))
x=list(map(int,input().split()))
y=sorted(x)
a,b,c=y[n//2-1],y[n//2],y[:n//2]
for i in x:
  print((b if i in c else a))

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


def read_input():
    n = int(eval(input()))
    xlist = list(map(int, input().split()))
    return n, xlist


def get_median(s):
    l = len(s)
    return s[int((l-1)/2)]


def submit():
    n, xlist = read_input()

    xlist = [(x, i) for i, x in enumerate(xlist)]
    xlist.sort(key=lambda x: x[0])

    pos_dic = {}
    for i, x in enumerate(xlist):
        pos_dic[x[1]] = i

    for i in range(n):
        target = pos_dic[i]
        p = xlist.pop(target)
        print((get_median(xlist)[0]))
        xlist.insert(target, p)




if __name__ == '__main__':
    submit()


# Optimized solution


def read_input():
    n = int(eval(input()))
    xlist = list(map(int, input().split()))
    return n, xlist


def get_median(s, ignore):
    l = len(s)
    if ignore < l/2:
        return s[int((l+1)/2)]
    else:
        return s[int((l-1)/2)]

def submit():
    n, xlist = read_input()

    xlist = [(x, i) for i, x in enumerate(xlist)]
    xlist.sort(key=lambda x: x[0])

    pos_dic = {}
    for i, x in enumerate(xlist):
        pos_dic[x[1]] = i

    for i in range(n):
        target = pos_dic[i]
        print((get_median(xlist, target)[0]))




if __name__ == '__main__':
    submit()
# Original solution
N = int(eval(input()))
xn = list(map(int,input().split()))
x0,x1 = sorted(xn)[N//2-1:N//2+1]
xm = (x0+x1)/2
for x in xn:
  print((x1 if x < xm else x0))


# Optimized solution
N = int(eval(input()))
xn = list(map(int,input().split()))
x0,x1 = sorted(xn)[N//2-1:N//2+1]
res = [x0 if x0 < x else x1 for x in xn]
print(('\n'.join(map(str,res))))
# Original solution
import statistics
N = int(eval(input()))
X = list(map(int, input().split()))
B = []
for i in range(N):
    X_sub = X[:i] + X[i+1:]
    B.append(statistics.median(X_sub))
for i in range(N):
    print((B[i]))

# Optimized solution
def calculate_median(lst):
    lst.sort()
    median_right = lst[int(len(lst)/2)]
    median_left = lst[int(len(lst)/2)-1]
    return median_right, median_left


N = int(eval(input()))
X = list(map(int, input().split()))
X_copy = X.copy()
median_right, median_left = calculate_median(X)
for i in range(N):
    if X_copy[i] >= median_right:
        print(median_left)
    elif X_copy[i] < median_right:
        print(median_right)
# Original solution
from statistics import median


N = int(eval(input()))
X = list(map(int, input().split()))
for i in range(N):
    x = X[:]
    del x[i]
    print((median(x)))

# Optimized solution
from statistics import median


N = int(eval(input()))
X = list(map(int, input().split()))
medi_X = median(X)
sort_X = sorted(X)

for x in X:
    if x < medi_X:
        print((sort_X[int((N + 1) / 2)]))
    else:
        print((sort_X[int(((N + 1) / 2) - 1)]))
# Original solution
import statistics
import math
N=int(eval(input()))
X=list(map(int,input().split()))
for i in range(N):
  l=X[:i]+X[i+1:]
  med=statistics.median(l)
  print(med)

# Optimized solution
N=int(eval(input()))
X=[int(x) for x in input().split()]
XX=sorted(X)
L=XX[N//2-1]
R=XX[N//2]
for x in X:
  print((L if x>=R else R))
# Original solution
import copy
N = int(eval(input()))
numList = list(map(int, input().split()))
medIndex = int((N-1)/2)

for i in range(0,N):
	numListCopy = copy.deepcopy(numList)
	numListCopy.pop(i)
	numListCopy = sorted(numListCopy)
	print((numListCopy[medIndex]))

# Optimized solution
import copy
N = int(eval(input()))
numList = list(map(int, input().split()))
numListCopy = copy.deepcopy(numList)
numList = sorted(numList)
medIndex = int((N)/2)
med1 = numList[medIndex-1]
med2 = numList[medIndex]


for i in range(0,N):
	if numListCopy[i] <= med1:
		print(med2)
	elif med2 <= numListCopy[i]:
		print(med1)
# Original solution
n = int(eval(input()))
X = list(map(int,input().split()))
medIndex = int((n-1)/2)
Z = sorted(X[:])
c1 = Z[int(n/2-1)]
c2 = Z[int(n/2)]
for i in range(n) :
  if (X[i] <= c1) :
    print(c2)
  else :
    print(c1)


# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
AA = sorted(A)
X = AA[N//2 - 1]
Y = AA[N//2]
for i in range(N):
  if A[i] < Y:
    print(Y)
  if A[i] >= Y:
    print(X)
# Original solution
import copy


def center(lst):
    lst.sort()
    value = lst[(len(lst) - 1) // 2]
    return value


def main():
    n = int(eval(input()))
    x_lst = list(map(int, input().split()))

    ans_lst = []
    for i in range(n):
        lst = copy.deepcopy(x_lst)
        del lst[i]
        ans_lst.append(center(lst))

    for i in range(n):
        print((ans_lst[i]))


if __name__ == '__main__':
    main()

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

    median1 = x_sorted_lst[n // 2 - 1]
    median2 = x_sorted_lst[n // 2]

    if median1 == median2:
        lst = [median1] * n

    else:
        lst = []
        for i in range(n):
            x = x_lst[i]

            if x <= median1:
                lst.append(median2)
            elif median2 <= x:
                lst.append(median1)

    for i in range(n):
        print((lst[i]))


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
lst = [int(i) for i in input().split()]
for i in range(n):
    local_lst = lst[:i] + lst[i+1:]
    lst_sort = sorted(local_lst)
    print((lst_sort[n//2-1]))

# Optimized solution
n = int(eval(input()))
lst = [int(i) for i in input().split()]
lst_sort = sorted(lst)
med = (lst_sort[n//2] + lst_sort[n//2-1])/2

for i in range(n):
    if lst[i] < med:
        print((lst_sort[n//2]))
    else:
        print((lst_sort[n//2-1]))
# Original solution
N = int(input())
X = sorted([[x,i] for i, x in enumerate(map(int,input().split()))])
med1,med2 = X[(N-1)//2][0], X[(N-1)//2+1][0]
ans = []
for idx1, x in enumerate(X):
  if idx1 <= (N-1)//2: ans.append([x[1],med2])
  else: ans.append([x[1],med1])
  #print(i)
[print(med) for i, med in sorted(ans)]


# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))
sorted_X = sorted(X)
med_options = [sorted_X[N//2-1], sorted_X[N//2]]

for i in range(N):
    if X[i] <= med_options[0]:
        print((med_options[1]))
    elif med_options[1] <= X[i]:
        print((med_options[0]))
# Original solution
n = int(eval(input()))
x = [[i,int(item)] for i,item in enumerate(input().split())]

x.sort(key= lambda x:x[1])

for i in range(n):
    ans = x[n//2][1] if i < n//2 else x[n//2-1][1]
    x[i].append(ans)

x.sort(key= lambda x:x[0])

for i in range(n):
    print((x[i][2]))

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

nx = sorted(x)
a = nx[n//2]
b = nx[n//2-1]

for i in range(n):
    ans = a if x[i] < a  else b
    print(ans)
# Original solution
n = int(eval(input()))
xm = list(map(int, input().split()))
xm_sort = sorted(xm)
a = n//2-1
for i in range(n):
    if xm[i]<=xm_sort[a]:
        print((xm_sort[a+1]))
    else:
        print((xm_sort[a]))

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

x_sort = sorted(x)
index = int(n/2)
num = x_sort[index]

for i in range(n):
    if x[i] < num:
        print((x_sort[index]))
    else:
        print((x_sort[index-1]))
# Original solution
def main():
    n=int(eval(input()))
    x = [int(i) for i in input().split()]
    x = tuple(x)
    for i in range(n):
        x_l=list(x)
        del x_l[i]
        x_l.sort()
        print((x_l[int((len(x_l)-1)/2)]))
            
main()

# Optimized solution
def main():
    n=int(eval(input()))
    x = [int(i) for i in input().split()]
    x_t = tuple(x)
    x.sort()
    l = x[int((len(x)/2 - 1))]
    u = x[int((len(x)/2))]
    for i in range(len(x_t)):
        if (x_t[i]<=l):
            print(u)
        else:
            print(l)
            
main()
# Original solution
from statistics import median
n=int(eval(input()))
l=list(map(int,input().split()))

for i in range(n):
    x=l[:]
    x.pop(i)
    print((median(x)))

# Optimized solution
from statistics import median, median_low, median_high

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

m_l=median_low(l)
m_h=median_high(l)

for i in range(n):
    if l[i] <= m_l:
        print(m_h)
    elif l[i] >= m_h:
        print(m_l)
# Original solution
import statistics
N = int(eval(input()))
X = list(map(int, input().split()))

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

# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))
L = sorted(X)
left = L[N//2-1]
right = L[N//2]

for x in X:
  if x <= left:
    print(right)
  else:
    print(left)
# Original solution
N = int(eval(input()))
X = list(map(int, input().split()))

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

# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))
tmp = X[:]
tmp.sort()
left, right = (tmp[N // 2 - 1], tmp[N // 2])
for i in range(N):
    if X[i] > left:
        print(left)
    else:
        print(right)
# Original solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from copy import deepcopy

n = int(readline())
x = list(map(int, readline().split()))
memo = sorted(x)
for xx in x:
    dx = deepcopy(memo)
    dx.remove(xx)
    if n % 2 == 0:
        print((dx[(n - 1) // 2]))
    else:
        print(((dx[(n - 1) // 2] + dx[(n - 1) // 2 - 1]) / 2))


# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
x = list(map(int, readline().split()))
memo = sorted(x)
dx = memo[n // 2]
for xx in x:
    print((memo[n // 2 - 1] if dx <= xx else dx))
# Original solution
import copy
N=int(eval(input()))
X=list(map(int,input().split()))
l=copy.copy(X)
for i in range(N):
    X.remove(l[i])
    X.sort(reverse=True)
    print((X[int((N-2)/2)]))
    X.insert(i,l[i])

# Optimized solution
N=int(eval(input()))
X=list(map(int,input().split()))
y=sorted(X,reverse=True)
for i in X:
    if i<y[(N-2)//2]:
        print((y[(N-2)//2]))
    else:
        print((y[N//2]))
# Original solution
import sys
input = sys.stdin.readline
n = int(input())
x = list(map(int, input().split()))
lists = []
ind = ((n-1) + 1) // 2
for i in range(n):
    if i == 0:
        ans = x[i + 1:]
        ans.sort()
        lists.append(ans[ind-1])
    else:
        ans = x[0:i] + x[i + 1:]
        ans.sort()
        lists.append(ans[ind - 1])
[print(x) for x in lists]


# Optimized solution
n = int(eval(input()))
x = list(map(int,input().split()))
y = sorted(x)[n//2-1:n//2+1]
for i in x:print((y[i <= y[0]]))
# Original solution
def main():
    n = int(eval(input()))
    center = (n+1)//2
    x_s = list(map(int,input().split()))
    sorted_x_s = sorted(x_s)

    for i in x_s:
        if sorted_x_s.index(i) < center:
            print((sorted_x_s[center]))
        else:
            print((sorted_x_s[center-1]))






if __name__ == '__main__':
    main()


# Optimized solution
def main():
    n = int(eval(input()))
    center = (n+1)//2
    x_s = list(map(int,input().split()))
    sorted_x_s = sorted(x_s)
    center_num = sorted_x_s[center]

    for i in x_s:
        if i < center_num:
            print((sorted_x_s[center]))
        else:
            print((sorted_x_s[center-1]))






if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
x = list(map(int, input().split()))
x_sorted = sorted(x)

cs = x_sorted[n // 2 - 1]
cb = x_sorted[n // 2]

for i, v in enumerate(x):
    if v <= cs:
        print(cb)
    else:
        print(cs)

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

smaller = sort_x[n//2-1]
bigger = sort_x[n//2]

for x in X:
    if x <= smaller:
        print(bigger)
    else:
        print(smaller)
# Original solution
from statistics import median

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

for i in range(n):
    x_median = x[0:i] + x[i+1:]
    print((median(x_median)))

# Optimized solution
n = int(eval(input()))
x = list(map(int, input().split()))
xsort = sorted(x)
x1, x2 = xsort[n//2-1], xsort[n//2]

for i in range(n):
    if x[i] <= x1:
        print(x2)
    else:
        print(x1)
# Original solution
N = int(eval(input()))
A = [int(x) for x in input().split()]
B = sorted(A)

l = B[N//2 -1]
r = B[N//2]

for a in A:
  if a<=l:
    print(r)
  else:
    print(l)

    

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

l = B[N//2 -1]
r = B[N//2]

for a in A:
  if a<r:
    print(r)
  else:
    print(l)
# Original solution
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

n=int(eval(input()))
Y=list(map(int,input().split()))
X=sorted(Y)
X0=X[n//2-1]
X1=X[n//2]
for i in  range(n):
    if Y[i]<=X0:
        print(X1)
    else:
        print(X0)



# Optimized solution
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(eval(input()))
X = list(map(int,input().split()))
Y = sorted(X)
a = Y[n//2-1]
b = Y[n//2]
for  xi in X:
  if xi <= a:print(b)
  else:
    print(a)
# Original solution
n = int(eval(input()))
li = list(map(int,input().split()))
for i in range(n):
  tmp = sorted(li[:i]+li[i+1:])
  print((tmp[int(n/2)-1]))

# Optimized solution
n = int(eval(input()))
li = list(map(int,input().split()))
lis = sorted(li)
m = lis[int(n/2)-1]
M = lis[int(n/2)]
for i in range(n):
  if li[i] <= m:
    print(M)
  else:
    print(m)
# Original solution
N = int(input())
X = []
for i, x in enumerate(map(int, input().split())):
    X.append((x, i))

X.sort()
Y = [0] * N
for j, (x, i) in enumerate(X):
    Y[i] = j

mid = N / 2
l = X[N // 2 - 1][0]
r = X[N // 2][0]
ans = []
for j in Y:
    if j < mid:
        ans.append(r)
    else:
        ans.append(l)

print(*ans, sep='\n')


# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))
order = {}
for idx, x in enumerate(X):
    order[idx] = x

X.sort()
m = N // 2
l = X[m - 1]
r = X[m]

for idx in range(N):
    x = order[idx]
    if x <= l:
        print(r)
    else:
        print(l)
# Original solution
N = int(eval(input()))
x = {}
ans = {}
y = []
k = 1
l = 1
for i in list(map(int,input().split())):
    x[k] = i
    y.append(i)
    k += 1

y.sort()
m_1 = y[int(N/2)]
m_2 = y[int(N/2)-1]

for i,j in sorted(list(x.items()),key = lambda x: x[1]):
    if (int(N/2) >= l):
        ans[i] = m_1
        l+=1
    else:
        ans[i] = m_2
        l+=1

for i,j in sorted(ans.items()):
    print(j)

# Optimized solution
N = int(eval(input()))
A = [int(i) for i in input().split()]
sortA = sorted(A)

for i in range(N):
    if A[i] < sortA[N//2]:
        print((sortA[N//2]))
    else:
        print((sortA[N//2 - 1]))
# Original solution
n,*x=list(map(int,open(0).read().split()))
y=sorted(x)
a,b=y[n//2],y[n//2-1]
for i in x:print((a*(i<=b)or b))

# Optimized solution
n,*x=list(map(int,open(0).read().split()))
y=sorted(x)[n//2-1:n//2+1]
for i in x:print((y[i<=y[0]]))
# Original solution
# 入力
n = int(eval(input()))
org_nums = list(map(int, input().split()))
# ソートは一回だけして、取り去る順番を明確にしてから１つずつ取り去り計算を行いたい
sorted_nums = sorted(org_nums) # 入力数列のソート
sorted_index = sorted(list(range(len(org_nums))), key=lambda k: org_nums[k]) #ソートされたリストから取り去る順番がわかる
extract_index = sorted(list(range(len(sorted_index))), key=lambda k: sorted_index[k]) #ソートされたリストから取り出すインデックスを取り出す順に並べる
#print(sorted_index)
#print(extract_index)
for i in extract_index:
    tmp = sorted_nums.copy()
    tmp.pop(i)
    print((tmp[(n-1)//2]))

# Optimized solution
# AC
# 入力
n = int(eval(input()))
org_nums = list(map(int, input().split()))
# ソートは一回だけして、取り去る順番を明確にしてから１つずつ取り去り計算を行いたい
sorted_nums = sorted(org_nums) # 入力数列のソート
sorted_index = sorted(list(range(len(org_nums))), key=lambda k: org_nums[k]) #ソートされたリストから取り去る順番がわかる
extract_index = sorted(list(range(len(sorted_index))), key=lambda k: sorted_index[k]) #ソートされたリストから取り出すインデックスを取り出す順に並べる
#print(extract_index)
for i in extract_index:
    if i+1 <= n // 2:
        print((sorted_nums[n//2]))
    else:
        print((sorted_nums[n//2-1]))
# Original solution
N = int(eval(input()))
X_list = list(map(int, input().split()))
idx_value = []

for idx, v in enumerate(X_list, 1):
    idx_value.append((idx, v,))

i_list = [i for i in range(1, N + 1)]
idx_value_copy = idx_value.copy()
idx_value_copy.sort(key=lambda x: x[1])
li_list = []
for t in idx_value:
    for idx, t_c in enumerate(idx_value_copy, 1):
        if t_c[0] == t[0] and t_c[1] == t[1]:
            li_list.append(idx)
            break

median_idx = int(N / 2)
median_left = idx_value_copy[median_idx - 1][1]
median_right = idx_value_copy[median_idx][1]
for i in li_list:
    if i <= median_idx:
        print(median_right)
    else:
        print(median_left)


# Optimized solution
N = int(eval(input()))
X_list = list(map(int, input().split()))
X_list_copy = X_list.copy()
X_list_copy.sort()

median_idx = int(N / 2)
left_num = X_list_copy[median_idx - 1]
right_num = X_list_copy[median_idx]

for x in X_list:
    if x < right_num:
        print(right_num)
    else:
        print(left_num)
# Original solution
n = int(eval(input()))
li = list(map(int, input().split()))
mid = (len(li)//2)-1

for i in range(n):
    temp = li[:i] + li[i+1:]
    temp.sort()
    print((temp[mid]))

# Optimized solution
n = int(eval(input()))
li = list(map(int, input().split()))
mid_id = (len(li)//2)
temp = li.copy()
temp.sort()
mid1 = temp[mid_id-1]
mid2 = temp[mid_id]
for i in li:
    if i <= mid1:
        print(mid2)
    else:
        print(mid1)