#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll x,a,b;
ll num[310]={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,1160290625,1252332576,1350125107,1453933568,1564031349,1680700000,1804229351,1934917632,2073071593,2219006624,2373046875,2535525376,2706784157,2887174368,3077056399,3276800000,3486784401,3707398432,3939040643,4182119424,4437053125,4704270176,4984209207,5277319168,5584059449,5904900000,6240321451,6590815232,6956883693,7339040224,7737809375,8153726976,8587340257,9039207968,9509900499,10000000000,10510100501,11040808032,11592740743,12166529024,12762815625,13382255776,14025517307,14693280768,15386239549,16105100000,16850581551,17623416832,18424351793,19254145824,20113571875,21003416576,21924480357,22877577568,23863536599,24883200000,25937424601,27027081632,28153056843,29316250624,30517578125,31757969376,33038369407,34359738368,35723051649,37129300000,38579489651,40074642432,41615795893,43204003424,44840334375,46525874176,48261724457,50049003168,51888844699,53782400000,55730836701,57735339232,59797108943,61917364224,64097340625,66338290976,68641485507,71008211968,73439775749,75937500000,78502725751,81136812032,83841135993,86617093024,89466096875,92389579776,95388992557,98465804768,101621504799,104857600000,108175616801,111577100832,115063617043,118636749824,122298103125,126049300576,129891985607,133827821568,137858491849,141985700000,146211169851,150536645632,154963892093,159494694624,164130859375,168874213376,173726604657,178689902368,183765996899,188956800000,194264244901,199690286432,205236901143,210906087424,216699865625,222620278176,228669389707,234849287168,241162079949,247609900000,254194901951,260919263232,267785184193,274794888224,281950621875,289254654976,296709280757,304316815968,312079600999,320000000000,328080401001,336323216032,344730881243,353305857024,362050628125,370967703776,380059617807,389328928768,398778220049,408410100000,418227202051,428232184832,438427732293,448816553824,459401384375,470184984576,481170140857,492359665568,503756397099,515363200000,527182965101,539218609632,551473077343,563949338624,576650390625,589579257376,602738989907,616132666368,629763392149,643634300000,657748550151,672109330432,686719856393,701583371424,716703146875,732082482176,747724704957,763633171168,779811265199,796262400000,812990017201,829997587232,847288609443,864866612224,882735153125,900897818976,919358226007,938120019968,957186876249,976562500000,996250626251,1016255020032,1036579476493,1057227821024,1078203909375,1099511627776,1121154893057,1143137652768,1165463885299,1188137600000,1211162837301,1234543668832,1258284197543,1282388557824,1306860915625,1331705468576,1356926446107,1382528109568,1408514752349,1434890700000,1461660310351,1488827973632,1516398112593,1544375182624,1572763671875,1601568101376,1630793025157,1660443030368,1690522737399,1721036800000,1751989905401,1783386774432,1815232161643,1847530855424,1880287678125,1913507486176,1947195170207,1981355655168,2015993900449,2051114900000,2086723682451,2122825311232,2159424884693,2196527536224,2234138434375,2272262782976,2310905821257,2350072823968,2389769101499,2430000000000};
ll now;
bool flag=false;
int main()
{
	scanf("%lld",&x);
	for(int i=0;i<=300;i++)
	{
		now=x+num[i];
		for(int j=0;j<=300;j++)
		{
			if(now==num[j])
			{
				flag=true;
				a=j;
				b=i;
				break;
			}
		}
		for(int j=0;j<=300;j++)
		{
			if(now+num[j]==0)
			{
				flag=true;
				a=-j;
				b=i;
				break;
			}
		}
		if(flag)	break;
	}
	for(int i=0;i<=300;i++)
	{
		if(flag)	break;
		now=x-num[i];
		for(int j=0;j<=300;j++)
		{
			if(now==num[j])
			{
				flag=true;
				a=j;
				b=-i;
				break;
			}
		}
		for(int j=0;j<=300;j++)
		{
			if(now+num[j]==0)
			{
				flag=true;
				a=-j;
				b=-i;
				break;
			}
		}
		if(flag)	break;
	}
	printf("%lld %lld\n",a,b);
	return 0;
}

Measured memory_bytes: 3836