require 'prime'
while n = gets
	n = n.to_i
	l,h = Enumerator.new {|y|
		t1 = 0
		t2 = 0
		Prime.each {|prim|
			if prim > n
				y << t1
				y << prim
			else
				t1 = t2
				t2 = prim
			end
		}
	}.take(2).to_a
	printf("%d %d",l,h)
	puts
end