n = int(eval(input()))

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



x_sorted = sorted(x)



mL = (n - 1) // 2

mR = mL + 1



anss = []

for i in range(n):

    if x[i] <= x_sorted[mL]:

        anss.append(x_sorted[mR])

    else:

        anss.append(x_sorted[mL])

for ans in anss:

    print(ans)
def main():

    N = int(eval(input()))

    *a, = list(map(int, input().split()))



    *b, = sorted(a)



    h = N // 2

    L = b[h - 1]

    R = b[h]



    for x in a:

        if x <= L:

            print(R)

        else:

            print(L)





if __name__ == '__main__':

    main()

n = int(eval(input()))
x = list(map(int, input().split()))
x_sorted = sorted(x)
mL = (n - 1) // 2
mR = mL + 1
anss = []
for i in range(n):
    if x[i] <= x_sorted[mL]:
        anss.append(x_sorted[mR])
    else:
        anss.append(x_sorted[mL])
for ans in anss:
    print(ans)

def main():
    N = int(eval(input()))
    (*a,) = list(map(int, input().split()))
    (*b,) = sorted(a)
    h = N // 2
    L = b[h - 1]
    R = b[h]
    for x in a:
        if x <= L:
            print(R)
        else:
            print(L)


if __name__ == "__main__":
    main()

-n = int(eval(input())) -x = list(map(int, input().split())) -x_sorted = sorted(x) -mL = (n - 1) // 2 -mR = mL + 1 -anss = [] -for i in range(n): -    if x[i] <= x_sorted[mL]: -        anss.append(x_sorted[mR]) -    else: -        anss.append(x_sorted[mL]) -for ans in anss: -    print(ans) +def main(): +    N = int(eval(input())) +    (*a,) = list(map(int, input().split())) +    (*b,) = sorted(a) +    h = N // 2 +    L = b[h - 1] +    R = b[h] +    for x in a: +        if x <= L: +            print(R) +        else: +            print(L) + + +if __name__ == "__main__": +    main()