import std.stdio;
import std.range;
import std.array;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.container;
import std.typecons;
import std.random;
import std.csv;
import std.regex;
import std.math;
import core.time;
import std.ascii;
import std.digest.sha;
import std.outbuffer;

enum int INF = 1 << 28;

alias Node = Tuple!(int, "value", int, "index");
bool comp(Node a, Node b) {
	if (a.value != b.value) {
		return a.value < b.value;
	}
	return a.index > b.index;
}

void main() {
	int n = readln.chomp.to!int;
	auto x = readln.chomp.split.map!(to!int).array;
	Node[] arr = new Node[](n);
	foreach (int i, v; x) {
		arr[i] = Node(v, i);
	}
	std.algorithm.sort!comp(arr);
	debug arr.writeln;
	debug arr.length.writeln;
	debug writeln = n / 2;
	immutable target = arr[n / 2];
	debug target.writeln;
	auto left = arr.assumeSorted!comp.lowerBound(Node(target.value, -INF)).back;
	debug "hello".writeln;
	debug left.writeln;
	foreach (i; 0..n) {
		debug writefln("[%d] %d", i, x[i]);
		Node dst = target;
		if (Node(x[i], i) >= left) {
			dst = arr[(n - 1) / 2];
		}
		dst.value.writeln;
	}
}

