import numpy as np

N = int(eval(input()))

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



X_sort = sorted(X)

small, big = X_sort[N//2-1], X_sort[N//2]



for x in X:

    if x >= big:

        print(small)

    else:

        print(big)
N = int(eval(input()))

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



X_sort = sorted(X)

small, big = X_sort[N//2-1], X_sort[N//2]



for x in X:

    if x >= big:

        print(small)

    else:

        print(big)
import numpy as np

N = int(eval(input()))
X = list(map(int, input().split()))
X_sort = sorted(X)
small, big = X_sort[N // 2 - 1], X_sort[N // 2]
for x in X:
    if x >= big:
        print(small)
    else:
        print(big)

N = int(eval(input()))
X = list(map(int, input().split()))
X_sort = sorted(X)
small, big = X_sort[N // 2 - 1], X_sort[N // 2]
for x in X:
    if x >= big:
        print(small)
    else:
        print(big)

-import numpy as np -