Problem:
 Score : 400 points    Problem Statement Give a pair of integers (A, B) such that A^5-B^5 = X .
It is guaranteed that there exists such a pair for the given integer X .      Constraints  1 \leq X \leq 10^9  X is an integer.  There exists a pair of integers (A, B) satisfying the condition in Problem Statement.         Input Input is given from Standard Input in the following format:  X       Output Print A and B , with space in between.
If there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.  A  B         Sample Input 1 33      Sample Output 1 2 -1  For A=2 and B=-1 , A^5-B^5 = 33 .       Sample Input 2 1      Sample Output 2 0 -1

Solution (Python):
import sys
input = sys.stdin.readline

x = int(input())
a = 1
while True:
    for b in range(0, a):
        if a**5 - b**5 == x:
            print(a, b)
            sys.exit()
        if a**5 + b**5 == x:
            print(a, -b)
            sys.exit()
    a += 1

Solution (Python):
x = int(input())

for i in range(-10**3, 10**3):
    for j in range(-10**3, 10**3):
        if i**5 - j**5 == x:
            print(i, j)
            exit()

Solution (Python):

import sys


def solve(X: int):
    ns = []
    for i in range(10000):
        ns.append(i**5)
    nsSet = set(ns)
    for bi in range(len(ns)):
        
        
        if X+ns[bi] in nsSet:
            ai = ns.index(X+ns[bi])
            print(ai,bi)
            exit()
        if X - ns[bi] in nsSet:
            ai = ns.index(X - ns[bi])
            print(ai, -(bi))
            exit()
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  
    solve(X)

if __name__ == '__main__':
    main()

Solution (Python):
x=int(input())
f=0
for i in range(-300,301):
    for j in range(-300,301):
        if i**5-j**5==x:
            print(i,j)
            f=1
            break
    if f==1:break

Solution (Python):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    X=I()
    
    flag=0
    
    for a in range(1000):
        if flag==1:
            break
        for b in range(1000):
            aa=pow(a,5)
            bb=pow(b,5)
            if aa-bb==X:
                print(a,b)
                flag=1
                break
            
            if aa+bb==X:
                print(a,-1*b)
                flag=1
                break
                

main()

Solution (Python):

import sys


def solve(X: int):
    l = set()
    for i in range(-10**3,10**3):
        l.add(i**5)

    for ll in l:
        a = X+ll
        if a in l:
            aa = 0
            bb = 0
            for i in range(-10**3,10**3):
                if i**5 == a:
                    aa = i
                    break
            for i in range(-10**3,10**3):
                if i**5 == ll:
                    bb = i
                    break

            print(aa,bb)
            return 

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  
    solve(X)

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    x = int(input())
    for a in range(-200, 200):
        for b in range(-200, 200):
            if a**5-b**5 == x:
                print(a, b)
                return


main()

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
printn = lambda x: print('\n'.join(x))

x = ni()
for i in range(-500, 501):
    for j in range(-500, 501):
        if i**5 - j**5 == x:
            print(i, j)
            exit(0)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

x = inp()
for i in range(10**3):
    for j in range(-2000,2000):
        if pow(i,5) - pow(j,5) == x:
            print(i,j)
            quit()

Solution (Python):
x = int(input())

ansl = []
for i in range(-1000, 1000):
    ansl.append(i**5)

for i in range(2000):
    for j in range(i+1, 2000):
        if ansl[j] - ansl[i] == x:
            print(j-1000, i-1000)
            exit()

Solution (Python):
x = int(input())

a = 1
while True:
    b = 0
    a5 = a ** 5
    b5 = b ** 5
    while a5 - b5 > x:
        b += 1
        b5 = b ** 5
    if a5-b5 == x:
        print(a, b)
        exit()

    b = 0
    b5 = b ** 5
    while a5 - b5 < x:
        b -= 1
        b5 = b ** 5
    if a5-b5 == x:
        print(a, b)
        exit()

    a += 1

Solution (Python):
X=int(input())
for i in range(-1000,1001):
    for j in range(-1000,1001):
        if i**5-j**5==X:
            print(i,j)
            break
    else:
        continue
    break

Solution (Python):
x=int(input())
import itertools
for a,b in itertools.product(range(-1000,1001),repeat=2):
    if x==a**5-b**5:
        print(a,b)
        break

Solution (Python):
def sol(n):
    d = {}
    N = 100000
    for i in xrange(-N, N+1):
        d[i**5]=i
    for i in d:
        j = n+i
        if j in d:
            print d[j], d[i]
            return

def main():
    n = input()
    sol(n)
if __name__ == '__main__':
    main()

Solution (Python):

import sys
from bisect import bisect_left,bisect_right
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    X=int(input())
    l=[i**5 for i in range(2000)]
    for i,a in enumerate(l):
        for j,b in enumerate(l):
            if a-b==X:
                print(i,j)
                exit()
            elif a+b==X:
                print(i,-j)
                exit()
    raise Exception
    

if __name__ == '__main__':
    main()

Solution (Python):
Five = [a**5 for a in range(120)]
X = int(input())
clear = 0
for o in range(119):
    for p in range(o+1,120):
        i = Five[o]
        j = Five[p]
        if j - i == X:
            print(f"{p} {o}")
            clear = 1
        if not clear and j + i == X:
            print(f"{p} {-o}")
            clear = 1
    if clear:break

Solution (Python):
import sys
x=int(input())
a=0
while True:
  for b in range(0,a):
    if a**5-b**5==x:
      print(a,b)
      sys.exit()
    if a**5+b**5==x:
      print(a,-1*b)
      sys.exit()
  a+=1

Solution (Python):

x = int(input())
a = 0
b = 0
f = 1
if f == 1:
    for a_ in range(-300, 300):
        if f == 1:
            for b_ in range(-300, 300):
                if a_**5-b_**5==x:
                    f = 0
                    print(a_, b_)
                    break

Solution (Python):
x = int(input())
for a in range(1,200):
    for b in range(-200,200):
        if (x == a**5-b**5):
            print(a,b)
            exit()

Solution (Python):
import sys

X = int(input())

for a in range(-1000,1001):
    for b in range(-1000,1001):
        if (a**5-b**5) == X:
            print(str(a)+" "+str(b))
            sys.exit()

Solution (Python):
import sys
input = sys.stdin.readline
X = int(input())
for A in range(-10 ** 3, 10 ** 3):
  for B in range(-10 ** 3, 10 ** 3):
    if A ** 5 - B ** 5 == X:
      print(A, B)
      exit(0)

Solution (Python):
x=int(input())
for a in range(-600,600):
	for b in range(-600,600):
		if a**5-b**5==x:
			print(a,b)
			exit()

Solution (Python):
X = int(input())

def binary_search(b):
    l, r = -10 ** 9, 10 ** 9
    while r-l > 1:
        m = (l+r)//2
        x = m**5 - b**5
        if x < X:
            l = m
        else:
            r = m
    return r

for b in range(-10000, 10000):
    a = binary_search(b)
    if a ** 5 - b ** 5 == X:
        print(a, b)
        break

Solution (Python):
x = int(input())
l = [0]
for i in range(1, 121):
    l.append(i**5)
now = 0
for i in range(1, len(l)):
    if now == 1:
        break
    for j in range(i):
        if l[i]+l[j] == x:
            print(i, -j)
            now = 1
            break
        elif l[i]-l[j] == x:
            print(i, j)
            now = 1
            break

Solution (Python):
import sys
X = int(input())

for i in range(-1000,1000):
    for j in range(-1000,1000):
        if i**5 -j**5 == X:
            print(i,j)
            sys.exit()

Solution (Python):
x=int(input())

f=[i for i in range(-128,129)]

from itertools import combinations as cmb
ok=False
for b,a in cmb(f,2):
    if x==a**5-b**5:
        ok=True
        aa=a
        bb=b
        break
if ok:print(aa,bb)

Solution (Python):
X = int(input())

flag = 0

for A in range(0, 1000):
  for B in range(-1000, 1000):
    if A ** 5 - B ** 5 == X:
      print(A, B)
      flag = 1
      break
  if flag == 1:
    break

Solution (Python):
x = int(input())
d = []
for i in range(-1000, 1000):
    d.append([i**5, i])

for j in range(len(d)):
    for i in range(len(d)):
        tmp = d[i][0] - d[j][0]
        if x == tmp:
            print(d[i][1], d[j][1])
            exit()

Solution (Python):

import os
import sys
from io import BytesIO, IOBase


def main():
    n=int(input())
    rg=int(n**(0.25))+10
    
    for b in range(-rg,rg+1):
        
        if (n+b**5)<0:
            l=-int((-n-b**5)**(0.2))
        else:
            l=int((n+b**5)**(0.2))
        while l**5<n+b**5:
            l+=1
        while l**5>n+b**5:
            l-=1
        if l**5-b**5==n:
            print(l,b)
            exit(0)
        



BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

Solution (Python):
import sys

X = int(input())

for a in range(-1000,1001):
    for b in range(-1000,1001):
        if (a**5-b**5) == X:
            print(str(a)+" "+str(b))
            sys.exit()

Solution (Python):


import itertools


def main():
  X = int(input())
  values = [0]

  for i in range(1, 200):
    values.append(i ** 5)

    if values[-1] - values[-2] > 1e9:
      break;

  for i, j in itertools.product(range(len(values)), repeat=2):
    if values[j] - values[i] == X:
      print('{} {}'.format(j, i))
      break
    elif values[j] + values[i] == X:
      print('{} {}'.format(j, -i))
      break
    elif -values[j] + values[i] == X:
      print('{} {}'.format(-j, -i))
      break


if __name__ == '__main__':
  main()

Solution (Python):
X=int(input())
for i in range(-200,201):
    for j in range(-200,201):
        if pow(i,5)-pow(j,5)==X:
            print(i,j)
            exit()

Solution (Python):
x = int(input())
for i in range(10**3):
    for j in range(-(10**3), 10**3):
        if (i**5)-(j**5)==x:
            print(i,j)
            exit()

Solution (Python):
X = int(input())

A = 0
B = 0
flag = False
for i in range(1, 1000):
    if flag == True:
        break
    for j in range(-1000, i):
        if flag == True:
            break
        if i**5 - j**5 == X:
            A = i
            B = j
            flag = True
print(A,B)

Solution (Python):
x = int(input())
n_list = []
for i in range(1000):
    n_list.append(i**5)
for i in range(1000):
    for j in range(1000):
        if n_list[i] - n_list[j] == x:
            print(i, j)
            exit()
        if n_list[i] + n_list[j] == x:
            print(i, j*(-1))
            exit()

Solution (Python):
import sys

X = int(input())

divider = []
for i in range(1,int(X**(1/2))+1):
    if X%i == 0:
        divider.append(i)
        divider.append(X//i)

for x in divider:
    B = -(x//2)
    while (B+x)**5-B**5<=X:
        if (B+x)**5-B**5==X:
            print(B+x,B)
            sys.exit()
        B+=1

Solution (Python):
x = int(input())


for i in range(500):
    for j in range(-500, 500):
        if i**5 - j**5 == x:
            print(i, j)
            exit()

Solution (Python):
import sys; input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))


def main():
	X = int(input())
	for i in range(-201, 201):
		for j in range(i + 1, 201):
			if j ** 5 - i ** 5 == X:
				print(j, i)
				return

	
	
	
	
	

if __name__ == '__main__':
	main()

Solution (Python):
X=int(input())
Y=int(X**0.5)
for B in range(-Y,Y):
    A = B**5+X;
    if A<B:
        continue
    A = A**0.2
    Ai = int(A)
    if Ai**5-B**5==X:
        print(Ai,B)
        break

Solution (Python):
X=int(input())

for i in range(-1000,1000):
    for j in range(-1000,1000):
        if i**5==j**5+X:
            A=i
            B=j
            break
print(A,B)

Solution (Python):
x=int(input())
for i in range(-1000,1000,1):
    for j in range(-1000,1000,1):
        if i**5-j**5==x:
            print(i,j)
            exit()

Solution (Python):
import sys
from math import floor
input = sys.stdin.readline
def main():
    X = int(input())
    for a in range(301):
        for b in range(301):
            if a**5-b**5==X:
                print(a,b)
                exit()
            if a**5+b**5==X:
                print(a,-b)
                exit()

if __name__ == "__main__":
    main()

Solution (Python):
X = int(input())

for B in range(-120, 120):
    for A in range(B,120):
        if A**5-B**5 == X:
            print(A,B)
            exit()

Solution (Python):
x = int(input())
s = [pow(i, 5) for i in range(1000)]
for i in range(1000):
    for j in range(2000):
        if j % 2 == 0:
            if s[i] - s[j // 2] == x:
                print(i, j // 2)
                exit()
        else:
            if s[i] + s[j // 2] == x:
                print(i, -(j // 2))
                exit()

Solution (Python):
k = [i ** 5 for i in range(200)]
x = int(input())
for a, i in enumerate(k):
    for b, j in enumerate(k):
        if i - j == x:
            ans = (a, b)
            break
        elif i + j == x:
            ans = (a, -b)
            break
ans = str(ans[0]) + ' ' + str(ans[1])
print(ans)

Solution (Python):
X = int(input())

for A in range(1000):
    for B in range(-1000, 1000):
        if (A ** 5) - (B ** 5) == X:
            print(A, B)
            exit()

Solution (Python):
N = int(input())

def ans():
  for x in range(-900,901):
    for y in range(-900,901):
      if x**5-y**5==N:
        print(x,y)
        return 0
      
ans()

Solution (Python):
import sys

input = sys.stdin.readline
MOD = 1000000007

X = int(input())

for  i in range(1000):
    for  j in range(-1000,1000):
        res = i**5 - j**5
        if X == res:
            print(i,j)
            exit()

Solution (Python):
import math
x = int(input())
cnt = 10**5
res = 0,0
for b in range(cnt):
    val = x+int(pow(b,5))
    if (int(val**0.2))**5 == val:
        res = int(val**0.2),b
        break
    val = x-b**5
    if val < 0:
        continue
    if (int(val**0.2))**5 == val:
        res = int(val**0.2),-b
        break
print(*res)

Solution (Python):





import sys


def main():
    arr = []
    for i in range(-(10 ** 4), 10 ** 4):
        arr.append((pow(i, 5), i))
    x = int(input())
    from bisect import bisect_left

    ans = False
    A, B = -1, -1
    for i in arr:
        c = i[0] - x
        idx = bisect_left(arr, (c, -(10 ** 20)))

        if idx < len(arr) and arr[idx][0] == c:
            ans = True
            A = i[1]
            B = arr[idx][1]
            break
    print(A, B)


get_array = lambda: list(map(int, sys.stdin.readline().split()))


get_ints = lambda: map(int, sys.stdin.readline().split())


input = lambda: sys.stdin.readline().strip()


if __name__ == "__main__":
    main()

Solution (Python):
x = int(input())
for i in range(-1000, 1000):
    i5 = i ** 5
    j5 = i5 - x
    if j5 < 0:
        j = (-j5) ** (1/5)
        j *= -1
    else:
        j = j5 ** (1/5)
    j = int(j)
    for cand in range(j - 10, j + 10):
        if i5 - cand ** 5 == x:
            print(i, cand)
            exit(0)

Solution (Python):
x=int(input())
for i in range(-1000,1000):
    for j in range(-1000,1000):
        if i**5 - j**5 == x:
            print(i,j)
            exit()

Solution (Python):
x = int(input())


def ab(x):
    for a in range(70):
        for b in range(70):
            if a ** 5 + b ** 5 == x:
                return (a, -b)

    for a in range(200):
        for b in range(a):
            if a ** 5 - b ** 5 == x:
                return (a, b)

a, b = ab(x)
print(a, b)

Solution (Python):
x = int(input())
ls = []
for i in range(-100000,100000):
  ls.append(i**5)
import bisect
for i in range(len(ls)):
  b = ls[i]
  ai = bisect.bisect_left(ls,x+b)
  if ai < len(ls) and ls[ai]-b == x:
    print(ai-100000,i-100000)
    break

Solution (Python):
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]
def init_dp1(init, N): return [init for _ in range(N)]
def init_dp2(init, N, M): return [[init for _ in range(M)] for _ in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    X = int(input())
    for B in range(1001):
        A5 = X + B ** 5
        A = int(A5 ** 0.2) if A5 > 0 else int((-A5) ** 0.2) * -1
        if A ** 5 == A5:
            print(A, B)
            return 

        A5 = X - B ** 5
        A = int(A5 ** 0.2) if A5 > 0 else int((-A5) ** 0.2) * -1
        if A ** 5 == A5:
            print(A, -B)
            return 

    print(-1)

if __name__ == "__main__":
    main()

Solution (Python):

import sys
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def slv(X):
    b = {}
    for i in range(0, 10**3):
        b[i**5] = i

    for a in range(0, 10**3):
        rem = X - (a ** 5)
        if rem in b:
            return (a, -b[rem])
        elif -rem in b:
            return (a, +b[rem])
        a *= -1
        rem = X - (a ** 5)
        if rem in b:
            return (a, -b[rem])
        elif -rem in b:
            return (a, +b[rem])

    assert False



def main():
    X = read_int()
    print(*slv(X))


if __name__ == '__main__':
    main()

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

x = I()
for i in range(-100, 100):
    for j in range(-100, 100):
        if i ** 5 - j ** 5 == x:
            print(i, j)
            exit()

for k in range(1, 10000):
    for l in range(10000):
        if (l + k) ** 5 - l ** 5 == x:
            print(l + k, l)
            exit()
        if (l + k) ** 5 - l ** 5 > x:
            break

Solution (Python):

import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *
































def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007




def main():
	X = inputInt()

	for A in range(1000):
		for B in range(-1000,1000,1):
			if A**5 - B**5 == X:
				print("{} {}".format(A,B))
				sys.exit()
	print("{} {}".format(-1,-1))






def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res


def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y



def H(n, r, mod=10**9+7):
	
	
    return combination(n+r-1, r, mod)


class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        
        
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv



def dfs(graph,parent,counter,edge):
    stk = []
    stk.append(edge)
    while len(stk) > 0:
        p = stk.pop()
        for e in graph[p]:
            if parent[p] == e:
                continue
            else:
                parent[e] = p
                counter[e] += counter[p]
                stk.append(e)

if __name__ == "__main__":
	main()

Solution (Python):
X = int(input())

for a in range(-500, 500):
    for b in range(-500, 500):
        if (a**5)-(b**5) == X:
            print(a, b)
            exit(0)

Solution (Python):
x = int(input())

for i in range(-1000, 1000):
    for j in range(-1000, 1000):
        if i ** 5 - j ** 5 == x:
            print(i, j)
            exit()

Solution (Python):

import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *
































def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007




def main():
	X = inputInt()

	for A in range(1000):
		for B in range(-1000,1000,1):
			if A**5 - B**5 == X:
				print("{} {}".format(A,B))
				sys.exit()
	print("{} {}".format(-1,-1))






def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res


def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y



def H(n, r, mod=10**9+7):
	
	
    return combination(n+r-1, r, mod)


class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        
        
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv



def dfs(graph,parent,counter,edge):
    stk = []
    stk.append(edge)
    while len(stk) > 0:
        p = stk.pop()
        for e in graph[p]:
            if parent[p] == e:
                continue
            else:
                parent[e] = p
                counter[e] += counter[p]
                stk.append(e)

if __name__ == "__main__":
	main()

Solution (Python):
import sys
x = int(input())
for b in range(-100000, 100000):
    a = (x+b**5)**(1/5)
    if type(a) == float:
        int_a = int(a)
        if int_a**5 - b**5 == x:
            print(int(a), b)
            exit()

Solution (Python):
from collections import defaultdict

def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))

x = inp()
a,b = 0,0
has = False
for i in range(1000):
    for j in range(1000,-1000,-1):
        if i**5 - j**5 == x:
            a,b = i,j
            has = True
            break
    if has:
        break
print(a,b)

Solution (Python):
A = [pow(n, 5) for n in range(300)]
B = [pow(n, 5) for n in range(300)]
a = -1
b = -1
x = int(input())
for n in range(300):
  for m in range(300):
    if A[n] - B[m] == x:
      a = n
      b = m
      break
    if A[n] + B[m] == x:
      a = n
      b = -m
      break
  if a >= n:
    break
print(a, b)

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

x = INT()

for a in range(-1000, 1001):
    for b in range(-1000, 1001):
        if a**5 - b**5 == x:
            print(a, b)
            exit()
raise Exception

Solution (Python):
x = int(input())
L = dict()
U = 10**4
for i, b in enumerate(range(-U, U+1), -U):
    L[b**5] = i
for b in range(-U, U+1):
    if b**5 + x in L:
        print(L[b**5 + x], b)
        exit()

Solution (Python):
x = int(input())

for a in range(-200, 200):
    for b in range(-200, 200):
        if(a**5 - b**5 == x):
            print(a,b)
            exit()

Solution (Python):
from sys import exit

X = int(input())
for i in range(400):
    for j in range(400):
        if (i - 200) ** 5 - (j - 200) ** 5 == X:
            print(i - 200, j - 200)
            exit()

Solution (Python):
x=int(input())
breakflag=0
for a in range(-500,500):
  for b in range(-500,a):
    if x==pow(a,5)-pow(b,5):
      print(a)
      print(b)
      breakflag=1
      break
  if breakflag==1:
    break

Solution (Python):
X = int(input())
arr = [0,1]
i = 2
while arr[-1]-arr[-2] <= 10**9:
    arr.append(i**5)
    i += 1

def printans(a,b,x,y):
    i = arr.index(a)
    j = arr.index(b)
    print(i*x,j*y)
    exit()

for a in arr:
    for b in arr:
        if a-b==X:
            printans(a,b,1,1)
        elif a+b==X:
            printans(a,b,1,-1)
        elif -a-b==X:
            printans(a,b,-1,1)
        elif -a+b==X:
            printans(a,b,-1,-1)

Solution (Python):
import sys
dic={}
for i in range(-300,300):
    dic[i**5]=i
x=int(input())
for b5 in dic:
    if x+b5 in dic:
        print(dic[x+b5],dic[b5])
        sys.exit()

Solution (Python):
X = int(input())
for i in range(-400, 400):
    for j in range(-400, 400):
        a = i
        b = j
        c = pow(a, 5) - pow(b, 5)
        if c == X:
            print(i, j)
            exit()

Solution (Python):
x=int(input())
for i in range(-300,300):
	for j in range(-300,300):
		if i**5-j**5==x:
			print(i,j)
			exit()

Solution (Python):

import sys
input = sys.stdin.readline

pattern = [(item**5, item) for item in range(-300, 300)]
x = int(input())

for a, i in pattern:
    for b, j in pattern:
        if a == x + b:
            print(i, j)
            exit()

Solution (Python):
import sys
sys.setrecursionlimit(10**9)
X = int(input())
for i in range(-300, 300):
    for j in range(-300, 300):
        if i**5 - j**5 == X:
            print(i, j)
            sys.exit()

Solution (Python):
x = int(input())
flag = False
for a in range(0, 1000):
  for b in range(-1000, 1000):
    if a**5-b**5 == x:
      print(a, b)
      flag = True
      break
  if flag:
    break