N = int(eval(input()))

numbers_r = tuple(map(int, input().split(' ')))

numbers_s = sorted(numbers_r)



med_high = numbers_s[N // 2]

med_low = numbers_s[N // 2 - 1]



for number in numbers_r:

    if number == med_low:

        print(med_high)

    elif number == med_high:

        print(med_low)

    elif number < med_low:

        print(med_high)

    elif number > med_high:

        print(med_low)

N = int(eval(input()))

numbers_r = tuple(map(int, input().split(' ')))

numbers_s = sorted(numbers_r)



med_high = numbers_s[N // 2]

med_low = numbers_s[N // 2 - 1]



for number in numbers_r:

    if number <= med_low:

        print(med_high)

    else:

        print(med_low)

N = int(eval(input()))
numbers_r = tuple(map(int, input().split(" ")))
numbers_s = sorted(numbers_r)
med_high = numbers_s[N // 2]
med_low = numbers_s[N // 2 - 1]
for number in numbers_r:
    if number == med_low:
        print(med_high)
    elif number == med_high:
        print(med_low)
    elif number < med_low:
        print(med_high)
    elif number > med_high:
        print(med_low)

N = int(eval(input()))
numbers_r = tuple(map(int, input().split(" ")))
numbers_s = sorted(numbers_r)
med_high = numbers_s[N // 2]
med_low = numbers_s[N // 2 - 1]
for number in numbers_r:
    if number <= med_low:
        print(med_high)
    else:
        print(med_low)

-    if number == med_low: +    if number <= med_low: -    elif number == med_high: +    else: -    elif number < med_low: -        print(med_high) -    elif number > med_high: -        print(med_low)