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