n = int(eval(input()))

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

lst = lst_x[:]

lst.sort()

b1 = lst[n//2 - 1]

b2 = lst[n//2]





for x in lst_x:

    if x <= b1:

        ans = b2

    else:

        ans = b1

    print(ans)
n = int(eval(input()))

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

lst = lst_x[:]

lst.sort()

b1 = lst[n//2 - 1]

b2 = lst[n//2]





for x in lst_x:

    print((b2 if x <= b1 else b1))

n = int(eval(input()))
lst_x = list(map(int, input().split()))
lst = lst_x[:]
lst.sort()
b1 = lst[n // 2 - 1]
b2 = lst[n // 2]
for x in lst_x:
    if x <= b1:
        ans = b2
    else:
        ans = b1
    print(ans)

n = int(eval(input()))
lst_x = list(map(int, input().split()))
lst = lst_x[:]
lst.sort()
b1 = lst[n // 2 - 1]
b2 = lst[n // 2]
for x in lst_x:
    print((b2 if x <= b1 else b1))

-    if x <= b1: -        ans = b2 -    else: -        ans = b1 -    print(ans) +    print((b2 if x <= b1 else b1))