n=int(eval(input()))

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

y = sorted(x)

x1, x2 = y[n//2-1], y[n//2]

for i in range(n):

    if x[i]<=x1:

        print(x2)

    else:

        print(x1)

n = int(eval(input()))

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

y = sorted(x)

x1, x2 = y[n//2-1], y[n//2]

for i, xx in enumerate(x):

    if xx<=x1:

        print(x2)

    else:

        print(x1)

n = int(eval(input()))
x = list(map(int, input().split()))
y = sorted(x)
x1, x2 = y[n // 2 - 1], y[n // 2]
for i in range(n):
    if x[i] <= x1:
        print(x2)
    else:
        print(x1)

n = int(eval(input()))
x = list(map(int, input().split()))
y = sorted(x)
x1, x2 = y[n // 2 - 1], y[n // 2]
for i, xx in enumerate(x):
    if xx <= x1:
        print(x2)
    else:
        print(x1)

-for i in range(n): -    if x[i] <= x1: +for i, xx in enumerate(x): +    if xx <= x1: