long n,s,i=5e4,t;main(j){scanf("%ld",&n);for(s=n;n%i|n/i%j<1?s=n%i|(t=i+j+n/i/j-3)>s?s:t,j=sqrt(n/--i)+2,i>1:--j;);s=!printf("%ld %ld",s,n-1);}