#include<stdio.h>
int a[70]={0,1,32,243,1024,3125,7776,16807,32768,59049,100000,161051,248832,371293,537824,759375,1048576,1419857,1889568,2476099,3200000,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,24300000,28629151,33554432,39135393,45435424,52521875,60466176,69343957,79235168,90224199,102400000,115856201,130691232,147008443,164916224,184528125,205962976,229345007,254803968,282475249,312500000,345025251,380204032,418195493,459165024,503284375,550731776,601692057,656356768,714924299,
777600000,844596301,916132832,992436543,1073741824};
int main()
{
	int x,i,n,j;
	scanf("%d",&x);
	for(i=1;i<70;i++)
	{
		if(x>a[i]&&x<a[i+1])
		{
			n=i;
			i=100;
		}
	}
	for(i=n;i>=0;i--)
	{
		for(j=0;j<i;j++)
		{
			if((a[i]-a[j])==x)
			{
				printf("%d %d",i,j);
				i=-1;
				j=1000;
			}
			if((a[i]+a[j])==x)
			{
				printf("%d %d",i,-j);
				i=-1;
				j=1000;
			}
		}
	}
    return 0;
}