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;

int INF = 1 << 28;

void main() {
	int n = readln.chomp.to!int;
	auto x = readln.chomp.split.map!(to!int).array;
	alias Node = Tuple!(int, "value", int, "index");
	Node[] arr = new Node[](n);
	foreach (int i, v; x) {
		arr[i] = Node(v, i);
	}
	std.algorithm.sort(arr);
	arr.writeln;
	immutable target = arr[n / 2];
	auto left = arr.assumeSorted.lowerBound(target);
	auto right = arr.assumeSorted.upperBound(target);
	// debug target.writeln;
	// debug left.writeln;
	// debug right.writeln;
	foreach (i; 0..n) {
		Node dst = target;
		// debug writeln("left =  ", left.lowerBound(Node(x[i], -INF)));
		// debug writeln("right = ", right.upperBound(Node(x[i], INF)));
		if (left.lowerBound(Node(x[i], -INF)).length == 0) {
			dst = arr[(n - 1) / 2];
		} else if (right.upperBound(Node(x[i], INF)).length == 0) {
			dst = arr[(n + 1) / 2];
		}
		dst.value.writeln;
	}
}

