CodeEff/ECCO huggingface dataset:
# Original solution
import copy
n=int(eval(input()))
l=list(map(int,input().split()))
cl=copy.deepcopy(l)
l.sort()
for i in range(n):
  tmp=cl[i]
  l.remove(tmp)
  print((l[n//2-1]))
  l.append(tmp)
  l.sort()

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

for i,j in zip(x,list(range(n))):
    x.remove(i)
    t = sorted(x)
    print((t[int(n/2-1)]))
    x.insert(j,i)

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

s = sorted(x)
u = s[int(n/2)]
t =s[int(n/2-1)]

for i in (x):
    if i < u:
        print(u)
    else:
        print(t)
# Original solution
from statistics import median
n = int(eval(input()))
a = list(map(int,input().split()))
for i in range(n):
    b = a.copy()
    b.remove(a[i])
    c = median(b)
    print(c)

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


if __name__ == "__main__":

    n = int(eval(input()))

    number_list = list(map(int,input().split()))
    tmp_list = number_list[:]
    tmp_list.sort()

    for number in number_list:
        i = tmp_list.index(number)
        if i < (n/2):
            print((tmp_list[int(n/2)]))
        else :
            print((tmp_list[int(n/2)-1]))


# Optimized solution


n = int(eval(input()))

number_list = list(map(int,input().split()))
tmp_list = sorted(number_list)


for number in number_list:
    if number < tmp_list[n//2]:
        print((tmp_list[n//2]))
    else :
        print((tmp_list[n//2-1]))
# Original solution


def main():
    N = int(eval(input()))
    X = list(map(int, input().split(" ")))

    nums = sorted(X)
    center = len(nums)//2
    if len(nums)%2 == 0:
        is_even = True
    else:
        is_even = False

    for x in X:
        i = nums.index(x)
        if i < center:
            if is_even:
                print((nums[center]))
            else:
                print((nums[center+1]))
        else:
            if is_even:
                print((nums[center-1]))
            else:
                print((nums[center+1]))


if __name__ == '__main__':
    main()


# Optimized solution


def main():
    N = int(eval(input()))
    X = list(map(int, input().split(" ")))

    nums = sorted(X)
    center = len(nums)//2

    dic = {}
    for i,x in enumerate(nums):
        if x not in dic:
            dic[x] = i

    if len(nums)%2 == 0:
        is_even = True
    else:
        is_even = False

    for x in X:
        i = dic[x]
        if is_even:
            if i < center:
                print((nums[center]))
            else:
                print((nums[center-1]))
        else:
            print((nums[center+1]))


if __name__ == '__main__':
    main()
# Original solution
import statistics
N = int(eval(input()))
X = list(map(int,input().split()))
for i in range(N) :
    x = X[0]
    X.pop(0)
    print((statistics.median(X)))
    X.append(x)



# Optimized solution
N = int(eval(input()))
X = list(map(int,input().split()))
Y = X.copy()
X = sorted(X)
bigger = X[N//2]
smaller = X[N//2-1]

for i in range(N) :
    if Y[i] >= bigger :
        print(smaller)
    else :
        print(bigger)
# Original solution
def median(L) :
    L = sorted(L)
    return L[len(L)//2]

N = int(eval(input()))
X = list(map(int,input().split()))
for i in range(N) :
    K = X[0:i] + X[(i+1):(N+1)]
    print((median(K)))


# Optimized solution
N = int(eval(input()))
X = list(map(int,input().split()))
L = sorted(X)
p = L[N//2-1]
q = L[N//2]
for i in range(N) :
    if X[i] <= p :
        print(q)
    else :
        print(p)
# Original solution
N = int(eval(input()))
X = list(map(int,input().split()))
idx = N//2-1
for i in range(N):
    tmp = X[:i] + X[i+1:]
    tmp.sort()
    print((tmp[idx]))

# Optimized solution
N = int(eval(input()))
X = list(map(int,input().split()))
mid = N//2-1
sX = sorted(X)
for i in range(N):
    if X[i] <= sX[mid]: print((sX[mid+1]))
    else: print((sX[mid]))
# Original solution
N = int(eval(input()))
X = [int(x) for x in input().split()]
X_nm = []
for n in range(N):
  X_nm.append([n, X[n]])
X_nm.sort(key=lambda x:x[1])

for n in range(N):
  idx = X_nm.index([n, X[n]])
  if idx+1 <= N//2:
    ans = X_nm[N//2][1]
    print(ans)
  else:
    ans = X_nm[N//2-1][1]
    print(ans)

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

XX = list(tuple(X))
XX.sort()
X_medium_1 = XX[(N//2)-1]
X_medium_2 = XX[N//2]

for n in range(N):
  if X[n] <= X_medium_1:
    print(X_medium_2)
  else: # X[n] >= X_medium_2:
    print(X_medium_1)
# Original solution
N = int(eval(input()))
X = tuple(int(x) for x in input().split())
length = len(X)
for x in range(length):
 print((sorted(X[:x]+X[x+1:])[length//2-1]))

# Optimized solution
N = int(eval(input()))
X = tuple(int(x) for x in input().split())
length = len(X)
med = sorted(X)[length//2-1:length//2+1]
for x in X:
 print((med[1] if x < sum(med)/2 else med[0]))
# Original solution
iN = int(eval(input()))
aX = [int(_) for _ in input().split()]

aXs = sorted(enumerate(aX),key=lambda x:x[1])

iMu  = iN//2
iMd  = iN//2 -1

iMuV = aXs[iMu][1]
iMdV = aXs[iMd][1]

if iMuV == iMdV:
    print(("\n".join([str(iMuV)]*iN)))
else:
    print(("\n".join(map(str,[iMuV if aX[x] < iMuV else iMdV for x in range(iN)]))))


# Optimized solution
iN = int(eval(input()))
aX = [int(_) for _ in input().split()]
aXs = sorted(aX)

iMu  = iN//2
iMd  = iN//2 -1

iMuV = aXs[iMu]
iMdV = aXs[iMd]

if iMuV == iMdV:
    print(("\n".join([str(iMuV)]*iN)))
else:
    print(("\n".join(map(str,[iMuV if x < iMuV else iMdV for x in aX]))))
# Original solution
N = int(eval(input()))
X = list(map(int,input().split()))
mid = []
for i in range(N):
  s = X[:i]+X[i+1:]
  s.sort()
  mid.append(s[(N-1)//2])
for m in mid:
  print(m)

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

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

# Optimized solution
n = int(eval(input()))
ls = list(map(int, input().split()))
ls2 = sorted(ls)
m0 = ls2[n // 2 - 1]
m1 = ls2[n // 2]
for x in ls:
    if x < m1:
        print(m1)
    else:
        print(m0)
# Original solution
# https://atcoder.jp/contests/abc094/tasks/arc095_a
# C - Many Medians
import copy

n = int(input().split()[0])
x_list = list(map(int, input().split()))
sorted_x_list = sorted(x_list)
mean_index = int((n + 1)/ 2) - 1
mean_list = []

a = str(sorted_x_list[mean_index])
b = str(sorted_x_list[mean_index + 1])
mean_list = [b if sorted_x_list.index(x) < n / 2 else a for x in x_list]

ans = '\n'.join(mean_list)
print(ans)

# Optimized solution
# https://atcoder.jp/contests/abc094/tasks/arc095_a
# C - Many Medians
import copy

n = int(input().split()[0])
x_list = list(map(int, input().split()))
sorted_x_list = sorted(x_list)
mean_index = int((n + 1)/ 2) - 1
mean_list = []

a = sorted_x_list[mean_index]
b = sorted_x_list[mean_index + 1]
for x in x_list:
    if x <= a:
        mean_list.append(str(b))
    else:
        mean_list.append(str(a))

ans = '\n'.join(mean_list)
print(ans)
# Original solution
import copy

n = int(eval(input()))
x = [int(num) for num in input().split()]
xx = sorted(x)

for i in range(n):
    x_ =copy.copy(xx) 
    x_.remove(x[i])
    b = x_[n//2 - 1]
    print(b)

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

mid_l = xx[n//2 -1]
mid_r = xx[n//2]

for _ in x:
    if _ <= mid_l:
        print(mid_r)
    else:
        print(mid_l)
# Original solution
import statistics
import copy

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

for i in range(len(X)):
    A = copy.deepcopy(X)
    del A[i]
    print((statistics.median(A)))


# Optimized solution
import statistics as sta

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

sort_X = sorted(X)
a = sta.median_low(sort_X)
b = sta.median_high(sort_X)

for i in range(N):
    if X[i] <= a:
        print(b)
    else:
        print(a)
# Original solution
import copy
N = int(eval(input()))

lst = list(map(int, input().split()))

for i in range(N):
  c_lst = copy.copy(lst)
  c_lst.pop(i)
  idx = len(c_lst) // 2
  sorted_lst = sorted(c_lst)
  print((sorted_lst[idx]))

# Optimized solution
import copy
N = int(eval(input()))

lst = list(map(int, input().split()))

sorted_lst = sorted(lst)
idx = (N-1) // 2
low = sorted_lst[idx]
high = sorted_lst[idx+1]
for i in range(N):
  if lst[i] <= low:
    print(high)
  else:
    print(low)
# Original solution
import copy
n=int(eval(input()))
box=list(map(int,input().split()))
box_sort=sorted(box)
for i in box:
    ano_box=copy.copy(box_sort)
    ano_box.remove(i)
    print((ano_box[n//2-1]))

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


# Optimized solution
n=int(eval(input()))
x=list(map(int,input().split()))
y = sorted(x)
x1, x2 = y[n//2-1], y[n//2]
for i in range(n):
    if x[i]<=x1:
        print(x2)
    else:
        print(x1)
# Original solution
import copy
n = int(eval(input()))
x = list(map(int,input().split()))
for i in range(n):
    xi = copy.deepcopy(x)
    xi.pop(i)
    xi = sorted(xi,reverse=True)
    print((xi[(n-2)//2]))

# Optimized solution
n = int(eval(input()))
x = list(map(int,input().split()))
x_sort = sorted(x)
med_l = x_sort[n//2-1]
med_r = x_sort[n//2]
for i in range(n):
    x[i]
    if x[i] <= med_l:
        print(med_r)
    else:
        print(med_l)
# Original solution
from statistics import mean, median,variance,stdev
n=int(eval(input()))
nn=n//2
x=[int(i) for i in input().split()]
y=x[:]
x.sort()

low_median=median(x[:n-1])
high_median=median(x[1:])

for i in range(n):
  if y[i]<high_median:
    print(high_median)
  else:
    print(low_median)

# Optimized solution
n=int(eval(input()))
nn=n//2
x=[int(i) for i in input().split()]
y=x[:]
x.sort()
 
low_median=x[nn-1]
high_median=x[nn]
 
for i in range(n):
  if y[i]<high_median:
    print(high_median)
  else:
    print(low_median)
# Original solution
import copy
n=int(eval(input()))
m=0
x=list(map(int,input().split()))
for i in range(n):
    y=copy.deepcopy(x)
    y.pop(i)
    if n%2==0:
        m=n//2
        y.sort()
        print((y[m-1]))
    else:
        m=n//2
        y.sort()
        print(((y[m]-y[m-1])/2))

# Optimized solution
N = int(eval(input()))
arr = []
for x in list(map(int,input().split())):
    arr.append(x)
sort_arr = sorted(arr)
mid1 = sort_arr[N//2-1]
mid2 = sort_arr[N//2]

for x in arr:
    if x <= mid1:
        print(mid2)
    else:
        print(mid1)
# Original solution
import copy


if __name__ == '__main__':
    N = int(eval(input()))
    X_list = list(map(int, input().split()))

    answer = -1
    for i in range(0, N):
        tmp_X_list = copy.deepcopy(X_list)
        del(tmp_X_list[i])
        tmp_X_list = sorted(tmp_X_list)
        answer = tmp_X_list[N//2-1]
        print(answer)


# Optimized solution
import copy


if __name__ == '__main__':
    N = int(eval(input()))
    X_list = list(map(int, input().split()))
    tmp_X_list = copy.deepcopy(X_list)
    tmp_X_list = sorted(tmp_X_list)
    med_minus1 = tmp_X_list[N//2-1]
    med_plus1 = tmp_X_list[N//2]

    answer = -1
    for i in range(0, N):
        if X_list[i] <= med_minus1:
            answer = med_plus1
        elif X_list[i] >= med_plus1:
            answer = med_minus1

        print(answer)
# Original solution
# 2019/08/08

from bisect import bisect_left,bisect_right

n=int(eval(input()))
x=list(map(int,input().split()))
xx=sorted(x)
mid=n//2

for i in range(n):
    if bisect_left(xx,x[i])<mid:
        print((xx[mid]))
    else:
        print((xx[mid-1]))

# Optimized solution
# 2019/08/08
from bisect import bisect_left,bisect_right

n=int(input())
x=list(map(int,input().split()))
xx=sorted(x)
mid=n//2

ans=[]
for i in range(n):
    if bisect_left(xx,x[i])<mid:
        ans.append(xx[mid])
    else:
        ans.append(xx[mid-1])
print(*ans,sep='\n')
# Original solution
N = int(input())
X = list(map(int, input().split()))
Y = list(enumerate(X))
Y.sort(key=lambda x:x[1])
mid = [Y[N//2-1][1], Y[N//2][1]]
ans = [-1] * N
for i, y in Y:
  if y <= mid[0]:
    ans[i] = mid[1]
  else:
    ans[i] = mid[0]

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


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

for x in X:
  if x <= m1:
    print(m2)
  else:
    print(m1)
# Original solution
from operator import itemgetter

N = int(eval(input()))
X = [(int(x),ind) for ind,x in enumerate(input().split())]
X.sort(key=itemgetter(0))
B = [0]*N
for i in range(N):
    B[X[i][1]] = (X[:i]+X[i+1:])[(N-2)//2]
for i in B:
    print((i[0]))


# Optimized solution
N = int(eval(input()))
X = [int(x) for x in input().split()]
B = sorted(X)
for i in X:
    if(i<B[N//2]):
        print((B[N//2]))
    else:
        print((B[N//2-1]))
# Original solution
n = int(eval(input()))
list_x = list(map(int, input().split()))
med = int(n / 2) - 1
for i in range(n):
  temp = list_x[:i] + list_x[i+1:]
  temp.sort()
  print((temp[med]))

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

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

for one_x in list_x:
  if one_x <= b:
    print(a)
  else:
    print(b)
# Original solution
N = int(eval(input()))
X = list(map(int,input().split()))
for i in range(N):
    Xi = X[i]
    X.pop(i)
    Xs = sorted(X)
    print((Xs[(N-1)//2]))
    X.insert(i,Xi)

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

x_sort = sorted(x1, key=lambda x: x[1])
t = int(n / 2)
lxt = []
for i in range(n):
    if i < t:
        lxt.append(x_sort[i][0])
    else:
        break

for i in range(n):
    if i in lxt:
        print((x_sort[t][1]))
    else:
        print((x_sort[t - 1][1]))


# Optimized solution
n = int(eval(input()))
x = list(map(int, input().split()))
x1 = []
for i, xi in enumerate(x):
    x1.append([i, xi])

x_sort = sorted(x1, key=lambda x: x[1])
t = int(n / 2)
lxt = []
for i in range(n):
    if i < t:
        x[x_sort[i][0]] = x_sort[t][1]
    else:
        x[x_sort[i][0]] = x_sort[t - 1][1]

for i in range(n):
    print((x[i]))
# Original solution
import copy

N = int(eval(input()))
L = list(map(int,input().split()))
A = copy.deepcopy(L)
A.sort()
for i in range(N):
  if (L[i] <= A[(N//2)-1]):
    print((A[N//2]))
  else:
    print((A[(N//2)-1]))

# Optimized solution
import copy
N = int(eval(input()))
L = list(map(int,input().split()))
C = copy.deepcopy(L)
C.sort()
P,Q = C[N//2-1],C[N//2]
for i in range(N):
  if L[i] <= P:
    print(Q)
  else:
    print(P)
# Original solution
n = int(eval(input()))
x = [int(i) for i in input().split()]
x_sorted = sorted(x)

x_1 = x_sorted[n // 2 - 1]
x_2 = x_sorted[n // 2]

for i in x:
    if x_sorted.index(i) < n // 2:
        print(x_2)
    else:
        print(x_1)

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

x_1 = x_sorted[n // 2 - 1]
x_2 = x_sorted[n // 2]

for x_ in x:
    if x_ <= x_1:
        print(x_2)
    else:
        print(x_1)
# Original solution
n = eval(input())
xn = list(map(int, input().split()))
for i in range(len(xn)):
    tmp = xn.copy()
    tmp.pop(i)
    tmp.sort()
    print((tmp[int((int(n) - 1) / 2)]))

# Optimized solution
n = int(eval(input()))
xn = list(map(int, input().split()))
xn_s = sorted(xn)
m1 = xn_s[n//2 - 1]
m2 = xn_s[n//2]
for x in xn:
    if x <= m1:
        print(m2)
    else:
        print(m1)
# Original solution
import copy
n = int(eval(input()))
x_tmp = input().split()
x = []
for _ in x_tmp:
    x.append(int(_))
num = n//2
for i in range(n):
    tmp_x = copy.copy(x)  # listを普通に代入すると、ディープコピーになる
    tmp_x.pop(i)  # pop(index)の出力は、削除した要素の値
    # その上で、popするとリスト自体も改変される
    # print(tmp_x)
    tmp_x = sorted(tmp_x, reverse=True)
    # print(tmp_x)
    print((tmp_x[num-1]))


# Optimized solution
n = int(eval(input()))
x_tmp = input().split()
x = [[0 for j in range(3)] for i in range(n)]
for i in range(n):
    x[i][0] = int(x_tmp[i])
    x[i][1] = i
x = sorted(x, key=lambda y: y[0])
mid = n//2
for i in range(n):
    if i <= mid-1:
        x[i][2] = x[mid][0]
    else:
        x[i][2] = x[mid-1][0]
x = sorted(x, key=lambda y: y[1])
for i in range(n):
    print((x[i][2]))
# Original solution
N=int(eval(input()))
X=list(map(int,input().split()))
sortedX=sorted(X)
a=sortedX[N//2-1]
b=sortedX[N//2]
for i in range(len(X)):
  if X[i]<b:
    print(b)
  else:
    print(a)

# Optimized solution
import sys
readline = sys.stdin.readline

N = int(readline())
X = list(map(int,readline().split()))

S = sorted(X)
mM = S[N // 2 - 1]
lM = S[N // 2]

for i in range(N):
  if X[i] <= mM:
    print(lM)
  else:
    print(mM)
# Original solution
import math
import copy
#import sys
#import bisect
#input = sys.stdin.readline
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
def lcm(a, b):
    return((a*b)//gcd(a,b))

def main():
    #x,y = map(int,input().split())	x=1,y=2
    #a = input().split()	a=['1','2','3',...,'n']
    #a = list(map(int,input().split()))	a=[1,2,3,4,5,...,n]
    #li = input().split('T')	FFFTFTTFF => li=['FFF', 'F', '', 'FF']
    n=int(eval(input()))
    a = list(map(int,input().split()))
    b=copy.copy(a)
    for i in range(n):
        x=b[i]
        a.sort()
        if x<=a[(n//2)-1]:
            print((a[(n//2)]))
        else:
            print((a[(n//2)-1]))

main()

# Optimized solution
import math
import copy
#import sys
#import bisect
#input = sys.stdin.readline
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
def lcm(a, b):
    return((a*b)//gcd(a,b))

def main():
    #x,y = map(int,input().split())	x=1,y=2
    #a = input().split()	a=['1','2','3',...,'n']
    #a = list(map(int,input().split()))	a=[1,2,3,4,5,...,n]
    #li = input().split('T')	FFFTFTTFF => li=['FFF', 'F', '', 'FF']
    n=int(eval(input()))
    a = list(map(int,input().split()))
    b=copy.copy(a)
    a.sort()
    for i in range(n):
        x=b[i]
        if x<=a[(n//2)-1]:
            print((a[(n//2)]))
        else:
            print((a[(n//2)-1]))

main()
# Original solution

n = int(eval(input()))
x_str = input().split()
xs = [int(c) for c in x_str]

center = (len(xs) - 1)//2

c_xs = xs[:]
c_xs.sort()

if c_xs[center] == c_xs[center+1]:
    for x in xs:
        print((c_xs[center]))
else:
    for x in xs:
        if x <= c_xs[center]:
            print((c_xs[center+1]))
        else:
            print((c_xs[center]))


# Optimized solution
n = int(input())
x_str = input().split()
xs = [int(c) for c in x_str]

xs_len = len(xs)
center = (xs_len - 1)//2

c_xs = xs[:]
c_xs.sort()

[print(c_xs[center+1] if x <= c_xs[center] else c_xs[center]) for x in xs]
# Original solution
n = int(eval(input()))
x_str = input().split()
xs = [int(c) for c in x_str]

xs_len = len(xs)
center = (xs_len - 1)//2

c_xs = xs[:]
c_xs.sort()

for x in xs:
    print((c_xs[center+1] if x <= c_xs[center] else c_xs[center]))


# Optimized solution
n = int(input())
x_str = input().split()
xs = [int(c) for c in x_str]

xs_len = len(xs)
center = (xs_len - 1)//2

c_xs = xs[:]
c_xs.sort()

[print(c_xs[center+1] if x <= c_xs[center] else c_xs[center]) for x in xs]
# Original solution
n = int(input())
X = list(map(int, input().split()))
xs = sorted(X)
x0, x1 = xs[n // 2 - 1:n // 2 + 1]
[print(x1) if xs.index(x) <= n // 2 - 1 else print(x0) for x in X]


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

# Optimized solution
n=int(eval(input()))
x=[int(i) for i in input().split()]
y=sorted(x)
for i in x:
    if i>y[n//2-1]:
        print((y[n//2-1]))
    else:
        print((y[n//2]))
# Original solution
import copy
n = int(eval(input()))
nums = list(map(int,input().split()))
for i in range(n):
    tmp = copy.deepcopy(nums)
    tmp.pop(i)
    tmp.sort()
    print((tmp[(n-1)//2]))

# Optimized solution
import copy
n = int(eval(input()))
nums = list(map(int,input().split()))
tmp = copy.deepcopy(nums)
tmp.sort()
cand1 = tmp[n//2]
cand2 = tmp[(n//2)-1]
for i in range(n):
    if nums[i] < cand1:
        print(cand1)
    else:
        print(cand2)
# Original solution
N = int(eval(input()))
X = list(map(int, input().split()))

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

# Optimized solution
N = int(eval(input()))
X = list(map(int, input().split()))
temp = sorted(X)
med = (temp[N//2]+temp[N//2-1])/2
for i in range(N):
    if X[i] < med:
        print((temp[N//2]))
    else:
        print((temp[N//2-1]))
# Original solution
import sys
readline = sys.stdin.readline
N = int(readline())
X = [int(x) for x in readline().split()]
sX = sorted(X)
h = {}
for i in range(len(sX)):
    h[sX[i]] = i
for i in range(N):
    p = h[X[i]]
    lr = sX[:p] + sX[p+1:]
    print((lr[len(lr) // 2]))

# Optimized solution
# O(N * log(Xn))
from bisect import bisect_left
import sys
readline = sys.stdin.readline
N = int(readline())
X = [int(x) for x in readline().split()]

# X = [i for i in range(2*10**5)]
# N = len(X)

sX = sorted(X)
m = (N - 1) // 2
for i in range(N):
    p = bisect_left(sX, X[i])
    if p <= m:
        print((sX[m + 1]))
    else:
        print((sX[m]))
# Original solution
import collections

N=int(eval(input()))

X=list(map(int,input().split()))

B_dict=collections.Counter(X)
B=sorted(B_dict.items())

cnt=0
for i in range(len(B)):
    cnt+=B[i][1]
    if cnt==N//2:
        ans1=B[i][0]
        ans2=B[i+1][0]
        break
    elif cnt>=N//2+1:
        ans1=B[i][0]
        ans2=B[i][0]
        break


for i in range(N):
    if X[i]<=ans1:
        print(ans2)
    else:
        print(ans1)



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

Xsorted=sorted(X)

ans1=Xsorted[(N-1)//2]
ans2=Xsorted[(N-1)//2+1]

for i in range(N):
    if X[i]<=ans1:
        print(ans2)
    else:
        print(ans1)