# 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()

# ABC094C - Many Medians (ARC095C)

def main():

    N, *X = list(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(("\n".join(map(str, ans))))





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()

# ABC094C - Many Medians (ARC095C)
def main():
    N, *X = list(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(("\n".join(map(str, ans))))


if __name__ == "__main__":
    main()

-    N, *X = map(int, open(0).read().split()) +    N, *X = list(map(int, open(0).read().split())) -    print(*ans, sep="\n") +    print(("\n".join(map(str, ans))))