import copy

N = int(eval(input()))

X = [int(i) for i in input().split()]

Y = copy.deepcopy(X)

Y.sort()



ML, MH = Y[N//2 - 1], Y[N//2]

for i in range(N):

    if X[i] >= MH:

        print(ML)

    else:

        print(MH)
import sys



def solve():

    input = sys.stdin.readline

    N = int(input())

    X = [int(x) for x in input().split()]

    Xsub = sorted(X)

    midl, midr = Xsub[(N - 1) // 2], Xsub[N // 2]

    ans = [0] * N

    for i, x in enumerate(X):

        if x <= midl: ans[i] = midr

        else: ans[i] = midl

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



    return 0



if __name__ == "__main__":

    solve()

import copy

N = int(eval(input()))
X = [int(i) for i in input().split()]
Y = copy.deepcopy(X)
Y.sort()
ML, MH = Y[N // 2 - 1], Y[N // 2]
for i in range(N):
    if X[i] >= MH:
        print(ML)
    else:
        print(MH)

import sys


def solve():
    input = sys.stdin.readline
    N = int(input())
    X = [int(x) for x in input().split()]
    Xsub = sorted(X)
    midl, midr = Xsub[(N - 1) // 2], Xsub[N // 2]
    ans = [0] * N
    for i, x in enumerate(X):
        if x <= midl:
            ans[i] = midr
        else:
            ans[i] = midl
    print(*ans, sep="\n")
    return 0


if __name__ == "__main__":
    solve()

-import copy +import sys -N = int(eval(input())) -X = [int(i) for i in input().split()] -Y = copy.deepcopy(X) -Y.sort() -ML, MH = Y[N // 2 - 1], Y[N // 2] -for i in range(N): -    if X[i] >= MH: -        print(ML) -    else: -        print(MH) + +def solve(): +    input = sys.stdin.readline +    N = int(input()) +    X = [int(x) for x in input().split()] +    Xsub = sorted(X) +    midl, midr = Xsub[(N - 1) // 2], Xsub[N // 2] +    ans = [0] * N +    for i, x in enumerate(X): +        if x <= midl: +            ans[i] = midr +        else: +            ans[i] = midl +    print(*ans, sep="\n") +    return 0 + + +if __name__ == "__main__": +    solve()