import sys



input = sys.stdin.readline





def main():

    N = int(eval(input()))

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



    A, B = sorted(X)[N // 2 - 1: N // 2 + 1]

    for x in X:

        if x <= A:

            print(B)

        else:

            print(A)





if __name__ == "__main__":

    main()

import sys



input = sys.stdin.readline





def main():

    N = int(input())

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



    A, B = sorted(X)[N // 2 - 1: N // 2 + 1]

    ans = [B if x <= A else A for x in X]

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





if __name__ == "__main__":

    main()

import sys

input = sys.stdin.readline


def main():
    N = int(eval(input()))
    X = list(map(int, input().split()))
    A, B = sorted(X)[N // 2 - 1 : N // 2 + 1]
    for x in X:
        if x <= A:
            print(B)
        else:
            print(A)


if __name__ == "__main__":
    main()

import sys

input = sys.stdin.readline


def main():
    N = int(input())
    X = list(map(int, input().split()))
    A, B = sorted(X)[N // 2 - 1 : N // 2 + 1]
    ans = [B if x <= A else A for x in X]
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

-    N = int(eval(input())) +    N = int(input()) -    for x in X: -        if x <= A: -            print(B) -        else: -            print(A) +    ans = [B if x <= A else A for x in X] +    print(*ans, sep="\n")