import collections



N=int(eval(input()))



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



B_dict=collections.Counter(X)

B=sorted(B_dict.items())



cnt=0

for i in range(len(B)):

    cnt+=B[i][1]

    if cnt==N//2:

        ans1=B[i][0]

        ans2=B[i+1][0]

        break

    elif cnt>=N//2+1:

        ans1=B[i][0]

        ans2=B[i][0]

        break





for i in range(N):

    if X[i]<=ans1:

        print(ans2)

    else:

        print(ans1)



N=int(eval(input()))

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



Xsorted=sorted(X)



ans1=Xsorted[(N-1)//2]

ans2=Xsorted[(N-1)//2+1]



for i in range(N):

    if X[i]<=ans1:

        print(ans2)

    else:

        print(ans1)



import collections

N = int(eval(input()))
X = list(map(int, input().split()))
B_dict = collections.Counter(X)
B = sorted(B_dict.items())
cnt = 0
for i in range(len(B)):
    cnt += B[i][1]
    if cnt == N // 2:
        ans1 = B[i][0]
        ans2 = B[i + 1][0]
        break
    elif cnt >= N // 2 + 1:
        ans1 = B[i][0]
        ans2 = B[i][0]
        break
for i in range(N):
    if X[i] <= ans1:
        print(ans2)
    else:
        print(ans1)

N = int(eval(input()))
X = list(map(int, input().split()))
Xsorted = sorted(X)
ans1 = Xsorted[(N - 1) // 2]
ans2 = Xsorted[(N - 1) // 2 + 1]
for i in range(N):
    if X[i] <= ans1:
        print(ans2)
    else:
        print(ans1)

-import collections - -B_dict = collections.Counter(X) -B = sorted(B_dict.items()) -cnt = 0 -for i in range(len(B)): -    cnt += B[i][1] -    if cnt == N // 2: -        ans1 = B[i][0] -        ans2 = B[i + 1][0] -        break -    elif cnt >= N // 2 + 1: -        ans1 = B[i][0] -        ans2 = B[i][0] -        break +Xsorted = sorted(X) +ans1 = Xsorted[(N - 1) // 2] +ans2 = Xsorted[(N - 1) // 2 + 1]