# ARC095C - Many Medians (ABC094C)

def main():

    n = int(eval(input()))

    x = list(map(int, input().rstrip().split()))

    sort_x = sorted(x)

    l, h = sort_x[n // 2 - 1], sort_x[n // 2]

    for i in x:

        if i <= l:

            print(h)

        else:

            print(l)





if __name__ == "__main__":

    main()
# ABC094C - Many Medians (ARC095C)

def main():

    N, *X = map(int, open(0).read().split())

    l, h = sorted(X)[N // 2 - 1 : N // 2 + 1]

    ans = [h if i <= l else l for i in X]

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





if __name__ == "__main__":

    main()

# ARC095C - Many Medians (ABC094C)
def main():
    n = int(eval(input()))
    x = list(map(int, input().rstrip().split()))
    sort_x = sorted(x)
    l, h = sort_x[n // 2 - 1], sort_x[n // 2]
    for i in x:
        if i <= l:
            print(h)
        else:
            print(l)


if __name__ == "__main__":
    main()

# ABC094C - Many Medians (ARC095C)
def main():
    N, *X = map(int, open(0).read().split())
    l, h = sorted(X)[N // 2 - 1 : N // 2 + 1]
    ans = [h if i <= l else l for i in X]
    print(*ans, sep="\n")


if __name__ == "__main__":
    main()

-# ARC095C - Many Medians (ABC094C) +# ABC094C - Many Medians (ARC095C) -    n = int(eval(input())) -    x = list(map(int, input().rstrip().split())) -    sort_x = sorted(x) -    l, h = sort_x[n // 2 - 1], sort_x[n // 2] -    for i in x: -        if i <= l: -            print(h) -        else: -            print(l) +    N, *X = map(int, open(0).read().split()) +    l, h = sorted(X)[N // 2 - 1 : N // 2 + 1] +    ans = [h if i <= l else l for i in X] +    print(*ans, sep="\n")