Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)

    for i in range(N):
        if Y.index(X[i])>(N//2)-1:
            print(Y[N // 2-1])
        else:
            print(Y[N//2])






resolve()

Fixed submission:
def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)
    l=Y[N // 2-1]
    r=Y[N//2]


    for i in X:
        if i<r:
            print(r)
        else:
            print(l)






resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)

    for i in range(N):
        if Y.index(X[i])>(N//2)-1:
            print(Y[N // 2-1])
        else:
            print(Y[N//2])






resolve()

Fixed submission:
def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)
    l=Y[N // 2-1]
    r=Y[N//2]


    for i in X:
        if i<r:
            print(r)
        else:
            print(l)






resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)
    Z=[(Y[:i]+Y[i+1:])[N//2-1] for i in range(N)]

    for i in range(N):
        print(Z[Y.index(X[i])])




resolve()


Fixed submission:
def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)
    l=Y[N // 2-1]
    r=Y[N//2]


    for i in X:
        if i<r:
            print(r)
        else:
            print(l)






resolve()

Buggy python submission (verdict: Runtime Error):
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
#import math
import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)
    Z=[(Y[:i]+Y[i+1:])[N//2-1] for i in range(N)]

    for i in range(N):
        print(Z[Y.index(X[i])])




resolve()

Fixed submission:
def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)
    l=Y[N // 2-1]
    r=Y[N//2]


    for i in X:
        if i<r:
            print(r)
        else:
            print(l)






resolve()

Buggy python submission (verdict: Time Limit Exceeded):
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
#import math
import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)
    Z=[(Y[:i]+Y[i+1:])[N//2-1] for i in range(N)]

    for i in range(N):
        print(Z[Y.index(X[i])])




resolve()

Fixed submission:
def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)
    l=Y[N // 2-1]
    r=Y[N//2]


    for i in X:
        if i<r:
            print(r)
        else:
            print(l)






resolve()

Buggy python submission (verdict: Time Limit Exceeded):
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
#import math
import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Z=[np.median(X[:i]+X[i+1:]) for i in range(N)]

    for i in range(N):
        print(int(Z[i]))



resolve()

Fixed submission:
def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)
    l=Y[N // 2-1]
    r=Y[N//2]


    for i in X:
        if i<r:
            print(r)
        else:
            print(l)






resolve()

Buggy python submission (verdict: Time Limit Exceeded):
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
#import math
import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)

    Z=[np.median(Y[:i]+Y[i+1:]) for i in range(N)]

    for i in range(N):
        print(int(Z[Y.index(X[i])]))



resolve()

Fixed submission:
def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)
    l=Y[N // 2-1]
    r=Y[N//2]


    for i in X:
        if i<r:
            print(r)
        else:
            print(l)






resolve()