import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    readint;
    auto a = readints;

    int m = cast(int)(a.length - 1) / 2; // 中央値の位置
    int left = m; // 中央値の左側の要素数
    auto b = a.dup.sort();

    auto median = b[m];
    auto median1 = b[m + 1];
    foreach (x; a) {
        if (x <= median) writeln(median1);
        else writeln(median);
    }
}
