import statistics





n = int(eval(input()))

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

m1 = statistics.median_low(x)

m2 = statistics.median_high(x)

for i in range(n):

    if x[i] <= m1:

        print(m2)

    else:

        print(m1)

n = int(eval(input()))

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

l = sorted(x)

m1 = l[n//2 - 1]

m2 = l[n//2]

for i in range(n):

    if x[i] <= m1:

        print(m2)

    else:

        print(m1)

import statistics

n = int(eval(input()))
x = [int(_) for _ in input().split()]
m1 = statistics.median_low(x)
m2 = statistics.median_high(x)
for i in range(n):
    if x[i] <= m1:
        print(m2)
    else:
        print(m1)

n = int(eval(input()))
x = [int(_) for _ in input().split()]
l = sorted(x)
m1 = l[n // 2 - 1]
m2 = l[n // 2]
for i in range(n):
    if x[i] <= m1:
        print(m2)
    else:
        print(m1)

-import statistics - -m1 = statistics.median_low(x) -m2 = statistics.median_high(x) +l = sorted(x) +m1 = l[n // 2 - 1] +m2 = l[n // 2]