#import <stdio.h>
#import <stdlib.h>
typedef long long INT;

typedef struct Pair {
    INT index;
    INT value;
} Pair;

int compare_value(const void *a, const void *b) {
    INT diff = ((Pair*)a)->value - ((Pair*)b)->value;
    return diff>0 ? 1: diff<0 ? -1 : 0;
}

int compare_index(const void *a, const void *b) {
    INT diff = ((Pair*)a)->index - ((Pair*)b)->index;
    return diff>0 ? 1: diff<0 ? -1 : 0;
}

int main(){
    INT N;
    scanf("%lld",&N);
    Pair X[200002];
    for(INT i=0;i<N;i++){
        INT x;
        scanf("%lld",&x);
        Pair p = {i, x};
        X[i] = p;
    }
    qsort(X, N, sizeof(Pair), compare_value);
    INT mid1 = X[N/2].value;
    INT mid2 = X[N/2-1].value;
    for(INT i=0;i<N;i++){
        X[i].value = (i<N/2) ? mid1 : mid2;
    }
    qsort(X, N, sizeof(Pair), compare_index);
    for(INT i=0;i<N;i++){
        printf("%lld\n", X[i].value);
    }
}
