unittest
{
	assert( [ "4", "2 4 4 3" ].parse.expand.solve == "4\n3\n3\n4" );
	assert( [ "2", "1 2" ].parse.expand.solve == "2\n1" );
	assert( [ "6", "5 5 4 4 3 3" ].parse.expand.solve == "4\n4\n4\n4\n4\n4" );
}



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

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( T )( T input )
if( isInputRange!T && is( ElementType!T == string ) )
{
	auto n = input.front.strip.to!( long );
	input.popFront;
	auto xs = input.front.split.to!( long[] );
	
	return tuple( xs );
}

auto solve( long[] xs )
{
	auto rs = new long[ xs.length ];
	
	auto xs_s = xs.dup.sort();
	auto cl = xs_s[ ( xs_s.length - 1 ) / 2 ];
	auto cr = xs_s[ ( xs_s.length + 1 ) / 2 ];
	
	foreach( i, x; xs )
	{
		if( x <= cl ) rs[ i ] = cr;
		else          rs[ i ] = cl;
	}
	
	return rs.to!( string[] ).join( "\n" );
}
