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