#include <bits/stdc++.h>
#include<algorithm>
#define mp make_pair
#define pb push_back
#define ll long long int 
#define ld long double
#define fi first
#define se second
#define mod 1000000007
#define test long long int t; cin>>t; while(t-->0)
#define fIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define loop(n) for(long long int i=0;i<n;i++)
#define loopr(n) for(long long int i=n-1;i>=0;i--)
#define lrp(a,b) for(long long int i=a;i<=b;i++)
#define lrn(a,b) for(long long int i=b;i>=a;i--)
#define endl '\n'
#define ivec vector<ll>
#define ivecp vector<pair<ll,ll>>
#define imap map<ll,ll>
#define uimap unordered_map<ll,ll>
#define iset set<ll>
#define cvec vector<char>
#define civecp vector<pair<char,ll>>
#define cimap map<char,ll>
#define ucimap unordered_map<char,ll>
#define cset set<char>
#define rr return 0
using namespace std;
//Declaration
const ll N=5e5+5;
vector<ll>adj[N];
//bool visited[N]={false};
ll parent[N];
ll rnk[N];
ll degree[N];
vector<ll>ax;



//Function call
bool isprime(ll n);
bool ispalin(ll num);
ll lcm(ll a, ll b); 
ll power(ll x, unsigned ll y);
ll gcd(ll a, ll b);
ll sumofdigits(ll n);
void sorts(string &str);
bool sortinrev(const pair<ll,ll>&a,const pair<ll,ll>&b);
bool sortbysec(const pair<ll,ll> &a, const pair<ll,ll> &b);
void countSort(ll arr[], ll n, ll exp);
void radixsort(ll arr[], ll n);
void print(ll arr[], ll n);
void make(ll a);
ll find(ll a);
void Union(ll a,ll b);

ll mins(ll arr[],ll n);



//solve
void solve()
{
    				
		ll arr[1000]={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,2470770901501,2512087224032,2553954421743,2596377985024,2639363440625,2682916351776,2727042318307,2771746976768,2817036000549,2862915100000,2909390022551,2956466552832,3004150512793,3052447761824,3101364196875,3150905752576,3201078401357,3251888153568,3303341057599,3355443200000,3408200705601,3461619737632,3515706497843,3570467226624,3625908203125,3682035745376,3738856210407,3796375994368,3854601532649,3913539300000,3973195810651,4033577618432,4094691316893,4156543539424,4219140959375,4282490290176,4346598285457,4411471739168,4477117485699,4543542400000,4610753397701,4678757435232,4747561509943,4817172660224,4887597965625,4958844546976,5030919566507,5103830227968,5177583776749,5252187500000,5327648726751,5403974828032,5481173216993,5559251349024,5638216721875,5718076875776,5798839393557,5880511900768,5963102065799,6046617600000,6131066257801,6216455836832,6302794178043,6390089165824,6478348728125,6567580836576,6657793506607,6748994797568,6841192812849,6934395700000,7028611650851,7123848901632,7220115733093,7317420470624,7415771484375,7515177189376,7615646045657,7717186558368,7819807277899,7923516800000,8028323765901,8134236862432,8241264822143,8349416423424,8458700490625,8569125894176,8680701550707,8793436423168,8907339520949,9022419900000,9138686662951,9256148959232,9374815985193,9494696984224,9615801246875,9738138110976,9861716961757,9986547231968,10112638401999,10240000000000,10368641602001,10498572832032,10629803362243,10762342913024,10896201253125,11031388199776,11167913618807,11305787424768,11445019581049,11585620100000,11727599043051,11870966520832,12015732693293,12161907769824,12309502009375,12458525720576,12608989261857,12760903041568,12914277518099,13069123200000,13225450646101,13383270465632,13542593318343,13703429914624,13865791015625,14029687433376,14195130030907,14362129722368,14530697473149,14700844300000,14872581271151,15045919506432,15220870177393,15397444507424,15575653771875,15755509298176,15937022465957,16120204707168,16305067506199,16491622400000,16679880978201,16869854883232,17061555810443,17254995508224,17450185778125,17647138474976,17845865507007,18046378835968,18248690477249,18452812500000,18658757027251,18866536236032,19076162357493,19287647677024,19501004534375,19716245323776,19933382494057,20152428548768,20373396046299,20596297600000,20821145878301,21047953604832,21276733558543,21507498573824,21740261540625,21975035404576,22211833167107,22450667885568,22691552673349,22934500700000,23179525191351,23426639429632,23675856753593,23927190558624,24180654296875,24436261477376,24694025666157,24953960486368,25216079618399,25480396800000,25746925826401,26015680550432,26286674882643,26559922791424,26835438303125,27113235502176,27393328531207,27675731591168,27960458941449,28247524900000,28536943843451,28828730207232,29122898485693,29419463232224,29718439059375,30019840638976,30323682702257,30629980039968,30938747502499,31250000000000,31563752502501,31880020040032,32198817702743,32520160641024,32844064065625,33170543247776,33499613519307,33831290272768,34165588961549,34502525100000,34842114263551,35184372088832,35529314273793,35876956577824,36227314821875,36580404888576,36936242722357,37294844329568,37656225778599,38020403200000,38387392786601,38757210793632,39129873538843,39505397402624,39883798828125,40265094321376,40649300451407,41036433850368,41426511213649,41819549300000,42215564931651,42614574994432,43016596437893,43421646275424,43829741584375,44240899506176,44655137246457,45072472075168,45492921326699,45916502400000,46343232758701,46773129931232,47206211510943,47642495156224,48081998590625,48524739602976,48970736047507,49420005843968,49872566977749,50328437500000,50787635527751,51250179244032,51716086897993,52185376805024,52658067346875,53134176971776,53613724194557,54096727596768,54583205826799,55073177600000,55566661698801,56063676972832,56564242339043,57068376781824,57576099353125,58087429172576,58602385427607,59120987373568,59643254333849,60169205700000,60698860931851,61232239557632,61769361174093,62310245446624,62854912109375,63403380965376,63955671886657,64511804814368,65071799758899,65635676800000,66203456086901,66775157838432,67350802343143,67930409959424,68514001115625,69101596310176,69693216111707,70288881159168,70888612161949,71492429900000,72100355223951,72712409055232,73328612386193,73948986280224,74573551871875,75202330366976,75835343042757,76472611247968,77114156402999,77760000000000,78410163603001,79064668848032,79723537443243,80386791169024,81054451878125,81726541495776,82403082019807,83084095520768,83769604142049,84459630100000,85154195684051,85853323256832,86557035254293,87265354185824,87978302634375,88695903256576,89418178782857,90145152017568,90876845839099,91613283200000,92354487127101,93100480721632,93851287159343,94606929690624,95367431640625,96132816409376,96903107471907,97678328378368,98458502754149,99243654300000,100033806792151,100828984082432,101629210098393,102434508843424,103244904396875,104060420914176,104881082626957,105706913843168,106537938947199,107374182400000,108215668739201,109062422579232,109914468611443,110771831604224,111634536403125,112502607930976,113376071188007,114254951251968,115139273278249,116029062500000,116924344228251,117825143852032,118731486838493,119643398733024,120560905159375,121484031819776,122412804495057,123347249044768,124287391407299,125233257600000,126184873719301,127142265940832,128105460519543,129074483789824,130049362165625,131030122140576,132016790288107,133009393261568,134007957794349,135012510700000,136023078872351,137039689285632,138062368994593,139091145134624,140126044921875,141167095653376,142214324707157,143267759542368,144327427699399,145393356800000,146465574547401,147544108726432,148628987203643,149720237927424,150817888928125,151921968318176,153032504292207,154149525127168,155273059182449,156403134900000,157539780804451,158683025503232,159832897686693,160989426128224,162152639684375,163322567294976,164499237983257,165682680855968,166872925103499,168070000000000,169273934903501,170484759256032,171702502583743,172927194497024,174158864690625,175397542943776,176643259120307,177896043168768,179155925122549,180422935100000,181697103304551,182978460024832,184267035634793,185562860593824,186865965446875,188176380824576,189494137443357,190819266105568,192151797699599,193491763200000,194839193667601,196194120249632,197556574179843,198926586778624,200304189453125,201689413697376,203082291092407,204482853306368,205891132094649,207307159300000,208730966852651,210162586770432,211602051158893,213049392211424,214504642209375,215967833522176,217438998607457,218918170011168,220405380367699,221900662400000,223404048919701,224915572827232,226435267111943,227963164852224,229499299215625,231043703458976,232596410928507,234157455059968,235726869378749,237304687500000,238890943128751,240485670060032,242088902178993,243700673461024,245321017971875,246949969867776,248587563395557,250233832892768,251888812787799,253552537600000,255225041939801,256906360508832,258596528100043,260295579597824,262003549978125,263720474308576,265446387748607,267181325549568,268925323054849,270678415700000,272440639012851,274212028613632,275992620215093,277782449622624,279581552734375,281389965541376,283207724127657,285034864670368,286871423439899,288717436800000,290572941207901,292437973214432,294312569464143,296196766695424,298090601740625,299994111526176,301907333072707,303830303495168,305763060002949,307705639900000,309658080584951,311620419551232,313592694387193,315574942776224,317567202496875,319569511422976,321581907523757,323604428863968,325637113603999,327680000000000,329733126404001,331796531264032,333870253124243,335954330625024,338048802503125,340153707591776,342269084820807,344394973216768,346531411903049,348678440100000,350836097125051,353004422392832,355183455415293,357373235801824,359573803259375,361785197592576,364007458703857,366240626593568,368484741360099,370739843200000,373005972408101,375283169377632,377571474600343,379870928666624,382181572265625,384503446185376,386836591312907,389181048634368,391536859235149,393904064300000,396282705113151,398672823058432,401074459619393,403487656379424,405912455021875,408348897330176,410797025187957,413256880579168,415728505588199,418211942400000,420707233300201,423214420675232,425733547012443,428264654900224,430807787028125,433362986186976,435930295269007,438509757267968,441101415279249,443705312500000,446321492229251,448949997868032,451590872919493,454244160989024,456909905784375,459588151115776,462278940896057,464982319140768,467698329968299,470427017600000,473168426360301,475922600676832,478689585080543,481469424205824,484262162790625,487067845676576,489886517809107,492718224237568,495563010115349,498420920700000,501292001353351,504176297541632,507073854835593,509984718910624,512908935546875,515846550629376,518797610148157,521762160198368,524740246980399,527731916800000,530737216068401,533756191302432,536788889124643,539835356263424,542895639553125,545969785934176,549057842453207,552159856263168,555275874623449,558405944900000,561550114565451,564708431199232,567880942487693,571067696224224,574268740309375,577484122750976,580713891664257,583958095271968,587216781904499,590490000000000,593777798104501,597080224872032,600397329064743,603729159553024,607075765315625,610437195439776,613813499121307,617204725664768,620610924483549,624032145100000,627468437145551,630919850360832,634386434595793,637868239809824,641365316071875,644877713560576,648405482564357,651948673481568,655507336820599,659081523200000,662671283348601,666276668105632,669897728420843,673534515354624,677187080078125,680855473873376,684539748133407,688239954362368,691956144175649,695688369300000,699436681573651,703201132946432,706981775479893,710778661347424,714591842834375,718421372338176,722267302368457,726129685547168,730008574608699,733904022400000,737816081880701,741744806123232,745690248312943,749652461748224,753631499840625,757627416114976,761640264209507,765670097875968,769716970979749,773780937500000,777862051529751,781960367276032,786075939059993,790208821317024,794359068596875,798526735563776,802711876996557,806914547788768,811134802948799,815372697600000,819628286980801,823901626444832,828192771461043,832501777613824,836828700603125,841173596244576,845536520469607,849917529325568,854316678975849,858734025700000,863169625893851,867623536069632,872095812856093,876586512998624,881095693359375,885623410917376,890169722768657,894734686126368,899318358320899,903920796800000,908542059128901,913182202990432,917841286185143,922519366631424,927216502365625,931932751542176,936668172433707,941422823431168,946196763043949,950990049900000,955802742745951,960634900447232,965486581988193,970357846472224,975248753121875,980159361278976,985089730404757,990039920079968,995009990004999};

		    ll x;
		    cin>>x;
		    bool flag=false;
		    loop(1000)
		    {
		        for(ll j=0;j<1000;j++)
		        {
		            if(arr[i]+arr[j]==x)
		            {
		                cout<<i<<" "<<j* -1<<endl;
		                flag=true;
		                break;
		            }
		            if(arr[i]-arr[j]==x)
		            {
		                cout<<i<<" "<<j<<endl;
		                flag=true;
		                break;
		            }
		        }
		        if(flag)
		        break;
		    }
		}






//Driver Code
int main() 
{
    fIO
    solve();
	rr;
}

Measured memory_bytes: 15388