unittest
{
	assert( [ "5", "6 9 4 2 11" ].parse.expand.solve == "11 6" );
	assert( [ "2", "100 0" ].parse.expand.solve == "100 0" );
}



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

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

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

auto solve( long[] as )
{
	as.sort();
	
	auto n = as[ $ - 1 ];
	as.popBack;
	auto c = n * 0.5L;
	auto r = long.max;
	foreach( a; as )
	{
		if( ( c - a ).abs < ( c - r ).abs ) r = a;
	}
	return format( "%s %s", n, r );
}
