N = int(eval(input()))

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

X_work = sorted(X)

before = X_work[N // 2]

after = X_work[N // 2 - 1]

for x in X:

    if x <= after:

        print(before)

    else:

        print(after)
import copy

N = int(eval(input()))

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

tmp_X = copy.deepcopy(X)

tmp_X.sort()

m1 = tmp_X[N // 2]

m2 = tmp_X[N // 2 - 1]

for x in X:

    if x < m1:

        print(m1)

    else:

        print(m2)
N = int(eval(input()))
X = list(map(int, input().split()))
X_work = sorted(X)
before = X_work[N // 2]
after = X_work[N // 2 - 1]
for x in X:
    if x <= after:
        print(before)
    else:
        print(after)

import copy

N = int(eval(input()))
X = list(map(int, input().split()))
tmp_X = copy.deepcopy(X)
tmp_X.sort()
m1 = tmp_X[N // 2]
m2 = tmp_X[N // 2 - 1]
for x in X:
    if x < m1:
        print(m1)
    else:
        print(m2)

+import copy + -X_work = sorted(X) -before = X_work[N // 2] -after = X_work[N // 2 - 1] +tmp_X = copy.deepcopy(X) +tmp_X.sort() +m1 = tmp_X[N // 2] +m2 = tmp_X[N // 2 - 1] -    if x <= after: -        print(before) +    if x < m1: +        print(m1) -        print(after) +        print(m2)