from statistics import median_low, median_high



n = int(eval(input()))

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



m1, m2 = median_low(xs), median_high(xs)



medians = [m2 if x < m2 else m1 for x in xs]

print(('\n'.join(map(str, medians))))
n = int(eval(input()))

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

 

ys = list(sorted(xs))

m1 = ys[n//2 - 1]

m2 = ys[n//2]

 

medians = [m2 if x < m2 else m1 for x in xs]

print(('\n'.join(map(str, medians))))
from statistics import median_low, median_high

n = int(eval(input()))
xs = list(map(int, input().split()))
m1, m2 = median_low(xs), median_high(xs)
medians = [m2 if x < m2 else m1 for x in xs]
print(("\n".join(map(str, medians))))

n = int(eval(input()))
xs = list(map(int, input().split()))
ys = list(sorted(xs))
m1 = ys[n // 2 - 1]
m2 = ys[n // 2]
medians = [m2 if x < m2 else m1 for x in xs]
print(("\n".join(map(str, medians))))

-from statistics import median_low, median_high - -m1, m2 = median_low(xs), median_high(xs) +ys = list(sorted(xs)) +m1 = ys[n // 2 - 1] +m2 = ys[n // 2]