long m,s,i=5e4,j;main(){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);m%i<1&&m/i%j;j--);s=!printf("%ld %ld",s,m-1);}