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