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



Sample input:
33


Sample output:
2 -1

Submission status: Accepted

Solution code:
import sys
 
x = int(input())
 
 
def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
 
    # divisors.sort()
    return divisors
 
 
for i in range(len(make_divisors(x))):
    for j in range(130):
        if j ** 5 - (j - make_divisors(x)[i]) ** 5 == x:
            print(j, j - make_divisors(x)[i])
            sys.exit()

Submission status: Accepted

Solution code:
import sys
x = int(input())
for i in range(-118,119):
  for j in range(-119,118):
    if i**5-j**5 == x:
      print(i,j)
      sys.exit()

Submission status: Accepted

Solution code:
a=int(input())
b=[]
for i in range(-150,150):
    for j in range(-150,150):
        if i**5-j**5==a:
            b.append(i)
            b.append(j)
            break
print(b[0],b[1])

Submission status: Accepted

Solution code:
a = -118;
c = 0;
d = 0;
x = int(input());

while a <= 119:
    b = -118
    while b <= 119:
        y = a**5 - b**5;
        if y == x :
            c = a;
            d = b;
        b = b + 1;
    
    a = a + 1;


print(c, d);

Submission status: Accepted

Solution code:
x = int(input())
# 1 <= x <= 10^9
for i in range(-1000, 1000):
    for j in range(-1000, 1000):
        if pow(i,5) - pow(j,5) == x:
            print(i, j)
            exit()

Submission status: Accepted

Solution code:
X=int(input())
five=[i**5 for i in range(1000) ]
flg=0
for i in range(len(five)):
    for j in range(len(five)):
        if five[i]+five[j]==X:
            flg=1
            ans_1=i
            ans_2=-j
        if five[i]-five[j]==X:
            ans_1=i
            ans_2=j
print(ans_1,ans_2)

Submission status: Accepted

Solution code:
X = int(input())

for i in range(-118, 120):
  for j in range(-119, i):
    if i**5 - j**5 == X:
      A = i
      B = j
    if j**5 - i**5 == X:
      B = i
      A = i

print('{} {}'.format(A, B))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    ok = False
    for b in range(-200, 201):
        for a in range(b + 1, 201):
            if a ** 5 - b ** 5 == x:
                print(a, b)
                ok = True
                break
        if ok:
            break


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def solve():
    x = int(input())
    for i in range(-1000, 1000):
        for j in range(-1000, 1000):
            if i**5-j**5 == x:
                print(i, j)
                quit()
    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    A = 0
    B = 0
    while True:
        A += 1
        for B in reversed(range(A*(-1)+1,A)):
            # print(A**5 - B**5)
            if A**5 - B**5 == X:
                print(A,B)
                return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())

A = []
B = []
for a in range(-118, 120):
    for b in range(-118, 120):
        if (a ** 5 - b ** 5) == X:
            A.append(a)
            B.append(b)

print(A[0], B[0])

Submission status: Accepted

Solution code:
#encoding utf-8
import math

def isAnswer(a, b, X):
    return int(math.pow(a, 5) - math.pow(b, 5)) == X

def pow5(x):
    if x < 0:
        return -1 * math.pow(abs(x), 5)
    return math.pow(x, 5)

def resolver(X):
    for b in range(-300, 300):
        a5 = X + pow5(b)
        if a5 < 0:
            continue
        a = int(math.pow(a5, 0.2))
        if isAnswer(a, b, X):
            return a, b 
    return 0, 0

def main():
    X = int(input())
    a,b = resolver(X)
    print(a, b)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

ans = 0
for a in range(-200, 200):
    for b in range(-200, 200):
        if a**5 - b**5 == x:
            ans = [a, b]
            break
    if ans != 0:
        break
print(ans[0], ans[1])

Submission status: Accepted

Solution code:
X=int(input())
flg=False
for A in range(-120,120):
    for B in range(-120,120):
        if A**5-B**5==X:
            print(str(A)+" "+str(B))
            flg=True
            break
    if flg:
        break

Submission status: Accepted

Solution code:
X = int(input())

def search(x):
    for A in range(-1000, 1000):
        for B in range(-1000, 1000):
            A5 = A**5
            B5 = B**5
            if A5 - B5 == x:
                print(A, B)
                return

search(X)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x =int(input())

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

Submission status: Accepted

Solution code:
x = int(input())
for i in range(238):
  a = i-118
  for j in range(238):
    b = j-119
    if a**5-b**5==x:
      print(a, b)
      exit()

Submission status: Accepted

Solution code:
x = int(input())

for a in range(-117, 120):
    for b in range(-117, 120):
        if x == a**5 - b**5:
            print(a, b)
            break
    else:
        continue
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

M = 21148

ns = [i**5 for i in range(M)]
n5s = {i**5:i for i in range(M)}

result = None
for i in range(M):
    b = ns[i]
    if b + X in n5s:
        result = n5s[b + X], i
    if X - b in n5s:
        result = i, -n5s[X - b]

print(*result)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
import math
import sys

x = int(input())
# aは正の数とする
# bが負の場合
max_a = math.floor(x ** (1/5))
for i in range(max_a,-1,-1):
    b5 = x - (i ** 5)
    b = round(b5 ** (1/5), 5)
    if b.is_integer():
        print(i,int(-1 * b))
        sys.exit()
# bが正の場合
for i in range(120):
    for j in range(i + 1, 120):
        if j**5 - i**5 == x:
            print(j, i)
            sys.exit()

Submission status: Accepted

Solution code:
def main():
    X=int(input())
    start=0
    back=-1
    while(True):
        back=X-pow(start,5)
        if back>0:
            A_back=int(pow(back,1/5))
        else:
            A_back=-int(pow(-back,1/5))

        front=X+pow(start,5)
        if front>0:
            A_front=int(pow(front,1/5))
        else:
            A_front=-int(pow(-front,1/5))
        if(pow(A_back,5)==back):
            A=A_back
            B=-start
            break
        elif(pow(A_front,5)==front):
            A=A_front
            B=start
            break
        else:
            start+=1
    print(A,B)
if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())
A = 0
B = 0
for i in range(-200,200):
    for j in range(-200,200):
        if X == i**5-j**5:
            A=i
            B=j

print(A,B)

Submission status: Accepted

Solution code:
X = int(input())
flg = False
for A in range(120):
    Ap = A**5
    for B in range(120):
        Bp = B**5
        if Ap-Bp==X:
            print(A,B)
            flg = True
            break
        elif Ap+Bp==X:
            print(A,-B)
            flg = True
            break
    if flg:
        break

Submission status: Accepted

Solution code:
x=int(input())
for i in range(-200,200):
  for j in range(-200,200):
    if i**5-j**5==x:
      a=i
      b=j
print(a,b)

Submission status: Accepted

Solution code:

X = int(input())

nukeru=0
for a in range(-400,401):
    for b in range(-400,401):
        if a**5 - b**5 == X:
            print(a,b)
            nukeru=1
        if nukeru==1:
            break
    if nukeru==1:
        break

Submission status: Accepted

Solution code:
X = int(input())

for i in range(1, 10**3):
    for j in range(i):
        if i**5 - j**5 == X:
            print(i, j)
            exit()
        elif i**5 + j**5 == X:
            print(i, -j)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
break_flag = 0
for i in range(120):
  for j in range(i):
    a, b = i, j
    if a**5 - b**5 == X:
      print(a, b)
      break_flag = 1
      break
    elif a**5 + b**5 == X:
      print(a, -b)
      break_flag = 1
      break
  if break_flag == 1:
    break

Submission status: Accepted

Solution code:
x = int(input())
for a in range(-500, 500):
    for b in range(-500, 500):
        n = a ** 5 - b ** 5
        if n == x:
            print(a, end=" ")
            print(b)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
X = int(input())
break_flag = 0
for i in range(1000):
  for j in range(i):
    a, b = i, j
    if a**5 - b**5 == X:
      print(a, b)
      break_flag = 1
      break
    elif a**5 + b**5 == X:
      print(a, -b)
      break_flag = 1
      break
  if break_flag == 1:
    break

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

Solution code:
x = int(input())


for i in range(-1000,1000):
    s = x + pow(i,5)
    t = pow(s,0.2)
    if(t.imag == 0):
        t = int(t)
        if(pow(t,5) == s):
            print(t,i)
            exit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import itertools
import operator
from functools import reduce  # Required in Python 3


def solve(X:int):
    for a in range(1, 125):
        for b in range(-125, 125):
            if a ** 5 - b ** 5 == X:
                print(a, b)
                return

def prod(iterable):
    return reduce(operator.mul, iterable, 1)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def solve_wrong(X: int):
    insu = [1] + prime_factorize(X)
    N = len(insu)
    ans_a = -99999999
    ans_b = -99999999
    for n in range(N):
        tmp = itertools.combinations(insu, n)
        for t in tmp:
            print(t)
            product = prod(t)
            b = 0
            while True:
                left = (b + product) ** 4 + (b + product) ** 3 * b + (b + product) ** 2 * (b ** 2) + (b + product) * (b ** 3) + b ** 4
                right = X // product
                if left == right:
                    ans_a = b + product
                    ans_b = b
                    break
                if left > right:
                    break
                b += 1
            b = 0
            while True:
                left = (b + product) ** 4 + (b + product) ** 3 * b + (b + product) ** 2 * (b ** 2) + (b + product) * (b ** 3) + b ** 4
                right = X // product
                if left == right:
                    ans_a = b + product
                    ans_b = b
                    break
                if left > right:
                    break
                b -= 1
            if ans_b != -99999999:
                break
        if ans_b > 0:
            break
    print(ans_a, ans_b)



    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np

x = int(input())
flag = False
for a in range(-200,200):
  for b in range(-200,200):
    if a<=b:
      break
    a_5 = np.power(a,5)
    b_5 = np.power(b,5)
    if a_5 - b_5 == x:
      flag =True
      print(a,b)
      break
  if flag:
    break

Submission status: Accepted

Solution code:
import sys
x = int(input())
for i in range(-120, 120):
    for j in range(-120, 120):
        if i**5 - j**5 == x:
            print(i, j)
            sys.exit()

Submission status: Accepted

Solution code:
def main():
    ans = 0
    x = int(input())
    for i in range(-118,120):
        for j in range(-118, 120):
            if i**5 - j**5 == x:
                ans = [i,j]
                break 
    print(ans[0], ans[1])

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())
 
for a in range(-118, 120):
    for b in range(-119, 119):
        if a**5 - b**5 == X:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x=int(input())
for i in range(-120,120):
  for j in range(-120,120):
    if i**5-j**5==x:
      a=i
      b=j
      print(a,b)
      exit()

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# (X - Y) (X^4 + X^3 Y + X^2 Y^2 + X Y^3 + Y^4)
X = ir()

def make_divisors(n):  # nの約数を列挙
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

U = 10 ** 4
div = make_divisors(X)
for a in range(U):
    for d in div:       
        b = a - d
        if a ** 5 - b ** 5 == X:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
import sys
x = int(input())
for a in range(-500, 500):
    for b in range(-500, 500):
        if a**5 - b**5 == x:
            print(a, b)
            sys.exit()

Submission status: Accepted

Solution code:
x=int(input())
m=0
for i in range(500):
  for k in range(500):
    w=i**5
    e=k**5
    r=k**5*-1
    if w-e==x:
      print(i,end=" ")
      print(k)
      m+=1
      break
    elif w-r==x:
      print(i,end=" ")
      print(k*-1)
      m+=1
      break
  if m==1:
    break

Submission status: Accepted

Solution code:
X = int(input())
for a in range(0,121):
    for b in range(-121,122):
        if X == a**5-b**5:
            print(a,b)
            break
    else:
        continue
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    flag=False
    x=int(input())
    for i in range(-200,200):
        for j in range(-200,200):
            if i**5-j**5==x:
                flag=True
                print(i,j)
                break
        if flag:
            break
resolve()

Submission status: Accepted

Solution code:
x=int(input())
s={0}
n=1
stop=0
while(1):
    N=n**5
    for i in s:
        if N-i==x:
            if i>0:
                sig=1
            elif i<0:
                sig=-1
            else:
                sig=0
            print(n,int(sig*pow(abs(i),1/5)))
            stop=1
        elif i-N==x:
            if i>0:
                sig=1
            elif i<0:
                sig=-1
            else:
                sig=0
            print(int(sig*pow(abs(i),1/5)),n)
            stop=1
    if stop==1:
        break
    s|={N,-N}
    n+=1

Submission status: Accepted

Solution code:
x=int(input())

for a in range(-118,119):
  for b in range(-119,118):
    if a**5-b**5==x:
      break
  else:
    continue
  break
  
print(a,b)

Submission status: Accepted

Solution code:
x = int(input())
for i in range(-1000,1000):
    for n in range(-1000,1000):
        if x==i**5-n**5:
            print(f"{i} {n}") 
            exit()

Submission status: Accepted

Solution code:
x=int(input())
ans=0
for i in range(-120,120):
    for j in range(-120,120):
        ans = i**5-j**5
        if ans == x:
            print(i,j)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
x = int(input())

ans = 0
for i in range(-120,120):
    for j in range(-120,120):
        ans = i**5 -j**5
        if ans == x:
            print(i,j)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
X = int(input())

import sys

for a in range(-118, 120):
    for b in range(-119, 119):
        if a**5 - b**5 == X:
            print(a, b)
            sys.exit()

Submission status: Accepted

Solution code:
from collections import deque
import sys
input = sys.stdin.readline


x = int(input().strip())
abs_x = abs(x)

def X(a, b):
    return a**5 - b**5

def X_plus(a, b):
    return a**5 + b**5

a = -118
b = -119


for a in range(-118, 119):
    #print(a)
    for b in range(-119, 118):
        #print(b)
        if X(a,b) == x:
            print(a,b)
            exit()

#print("not found")

Submission status: Accepted

Solution code:
x=int(input())

for i in range(-200,201):
    for j in range(-200,201):
        if i**5-j**5==x:
            a=i
            b=j
            break
print(a,b)

Submission status: Accepted

Solution code:
x = int(input())
for i in range(-150,150):
    for j in range(-150,150):
        if i**5 - j**5 == x:
            A = i
            B = j
            break

print(A,B)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())
for i in range(-500,501):
    for j in range(-500,501):
        if pow(i,5)-pow(j,5) == X:
            print(i, j)
            exit()

Submission status: Accepted

Solution code:
import math
x=int(input())
for i in range(1,150):
    a=i**5
    for j in range(-150,150):
        if a-j**5==x:
            print(i,j)
            exit()

Submission status: Accepted

Solution code:
X = int(input())
for A in range(-198,200):
    for B in range(-119,119):
        if pow(A,5) - pow(B,5) == X:
            print('{} {}'.format(A,B))
            exit()

Submission status: Accepted

Solution code:
X=int(input())
flag=0
for i in range(-129,129):
  for j in range(-129,129):
    if i*i*i*i*i-j*j*j*j*j==X:
      if flag==0:
        print(i,j)
        flag=1

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
N= int(input())
x=0
a=0


for a in range(121):
    for b in range(-120,120):
        x = a ** 5 - b ** 5
        if x==N:
            an=str(a)+" "+str(b)
print(an)

Submission status: Accepted

Solution code:
x = int(input())

flg = False
for a in range(-118, 120):
  for b in range(-118, 120):
    if a**5 - b**5 == x:
      print(a, b)
      flg = True
      break
  if flg:
    break

Submission status: Accepted

Solution code:
import math
X=int(input())
end=False
for i in range(-120,120):
    for j in range(-120,120):
        if pow(i,5) - pow(j,5) == X:
            print(i,j)
            end=True
            break
    if end==True:
        break

Submission status: Accepted

Solution code:
X = int(input())

'''
N**5 - (N-1)**5 <= 1000000000 となるNの絶対値を求めておく

N = 0
while True:
    if N**5 - (N-1)**5 > 1000000000:
        print(N)
        break
    N += 1

N = 120 となるため、-120から120を全探索の範囲にする
'''

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

Submission status: Accepted

Solution code:
X = int(input())

for a in range(-118, 120):
    for b in range(-119, 119):
        if a**5 - b**5 == X:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
# D
import math
X = int(input())

B = -math.floor(math.pow(X, 0.2))
for b in range(B, 1000):
    a = int(math.pow(X + b ** 5, 0.2))
    if a ** 5 - b ** 5 == X:
        break
        
print(a, b)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# べき乗は、a ** n or pow(a, n)
X = int(input())
# X = a**5 - b**5 
#   = (a-b)(a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4)
# よって、X は　a-b　の倍数 X%(a-b) = 0

# a**5  = b**5 + X
#   a   = ( b**5 + X )**(1/5)
# X< 10**9 を満たす a,bの最大値は、120 , 119
flag = False
for ai in range(-119,120):
    for bi in reversed(range(-120,119)):
        if ai - bi != 0 and X > (ai - bi):
            if X % (ai - bi) == 0:
                if ai**5 - bi**5 ==X:
                    print(int(ai),int(bi))
                    flag = True
                    break
        else:
            if ai**5 - bi**5 ==X:
                print(int(ai),int(bi))
                flag = True
                break
    if flag:
        break

Submission status: Accepted

Solution code:
data = {}
count = 0
max_num = 10**9
before = 0
while True:
    tmp = count**5
    data[count] = tmp
    data[-count] = -tmp
    count+=1
    if tmp - before > max_num:
        break
    before = tmp

x = int(input())
for k, v in data.items():
    for k2, v2 in data.items():
        if v - v2 == x:
            print(k, k2)
            exit()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# べき乗は、a ** n or pow(a, n)
X = int(input())
# X = a**5 - b**5 
#   = (a-b)(a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4)
# よって、X は　a-b　の倍数 X%(a-b) = 0

# a**5  = b**5 + X
#   a   = ( b**5 + X )**(1/5)
# X< 10**9 を満たす a,bの最大値は、120 , 119
flag = False
for ai in range(-119,120):
    for bi in range(-120,119):
        if ai - bi != 0 and X > (ai - bi):
            if X % (ai - bi) == 0:
                if ai**5 - bi**5 ==X:
                    print(int(ai),int(bi))
                    flag = True
                    break
        else:
            if ai**5 - bi**5 ==X:
                print(int(ai),int(bi))
                flag = True
                break
    if flag:
        break

Submission status: Accepted

Solution code:
X = int(input())
# X = a**5 - b**5 
#   = (a-b)(a**4 + a**3 * b + a**2 * b**2 + a * b**3 + b**4)
# よって、X は　a-b　の倍数 X%(a-b) = 0

# a**5  = b**5 + X
#   a   = ( b**5 + X )**(1/5)
# X< 10**9 を満たす a,bの最大値は、120 , 119
flag = False
for ai in range(-119,120):
    for bi in range(-120,119):
        if ai - bi != 0 and X > (ai - bi):
            if X % (ai - bi) == 0:
                if ai**5 - bi**5 ==X:
                    print(int(ai),int(bi))
                    flag = True
                    break
        else:
            if ai**5 - bi**5 ==X:
                print(int(ai),int(bi))
                flag = True
                break
    if flag:
        break

Submission status: Accepted

Solution code:
# 初期入力
import sys
import math
#input = sys.stdin.readline
X = int(input())
limit =10**5
a=0
b=0
for b in range(-1*limit ,limit):
    a5 =X+pow(b,5)
    if 0 <= a5: 
        a=math.pow(a5,0.2)
        a_int =int(a)
        dif =a_int**5 -b**5 -X
        if abs(dif)<10**(-5):
            break
    else:
        continue
print(a_int,b)

Submission status: Accepted

Solution code:
# D
import math
X = int(input())

B = -math.floor(math.pow(X, 0.2))
for b in range(B, 100000):
    tmp = math.pow(X + b ** 5, 0.2)
    if math.floor(int(tmp) - tmp + 1.0e-6) == 0:
        break
        
tmp = int(tmp)
print(tmp, b)

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
# D
import math
X = int(input())

B = -math.floor(math.pow(X, 0.2))
for b in range(B, 100000):
    tmp = math.pow(X + b ** 5, 0.2)
    if math.floor(int(tmp) - tmp + 1.0e-6) == 0:
        break
        
tmp = math.floor(tmp + 1.0e-6)
print(tmp, b)

Submission status: Accepted

Solution code:
def main():
  x = int(input())
  for i in range(1000):
    for j in range(-1000,1000):
      if i**5 - j**5 == x:
        print(i,j)
        return
main()

Submission status: Accepted

Solution code:
x = int(input())

ans1, ans2 = 0,0
for i in range(-200,200):
    for j in range(-200,200):
        if i**5 - j**5 == x:
            # print(i,j)
            ans1, ans2 = i,j

print(ans1,ans2)

Submission status: Accepted

Solution code:
x = int(input())
for i in range(-118,120):
    for j in range(-119,119):
        if i**5-(j**5) == x:
            print(i,j)
            break
    else:
        continue
    break

Submission status: Accepted

Solution code:
X = int(input())
A = [i**5 for i in range(-118,120)]
A_posi = [i for i in range(-118,120)]
B = [i**5 for i in range(-119,119)]
B_posi = [i for i in range(-119,119)]
result = [0]*2
for i in range(len(A)):
    for j in range(len(B)):
        if A[i] -B[j] ==X:
            result[0] = A_posi[i]
            result[1] = B_posi[j]
            break
print(*result)

Submission status: Accepted

Solution code:
def a5b5(X):
    for i in range(1000):
        for j in range(-1000, 1000):
            if (i**5 - j**5 == X):
                print(i, j)
                return        


X = int(input())
A = 0
B = 0
a = a5b5(X)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def main():
    X = int(input())
    for i in range(1000):
        for j in range(-1000, 1000):
            if (i**5-j**5) == X:
                print(i, j)
                return
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
def resolve():
	x = int(input())
	for i in range(1000):
		for j in range(-1000, 1000):
			if i**5 - j**5 == x:
				print(i, j)
				return

resolve()

Submission status: Accepted

Solution code:
x=int(input())
a=0
b=0
for i in range(-130,130):
    for j in range(-130,130):
        if(i**5-j**5==x):
            a,b=i,j
            break
print(a,b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline

def main():
    X = int(readline())
    for a in range(-118, 120):
        for b in range(-118, 120):
            if a ** 5 - b ** 5 == X:
                print(a, b)
                return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X=int(input())
for A in range(-500,501):
    for B in range(-500,501):
        if(A**5-B**5==X):
            print(A,B)
            exit()

Submission status: Accepted

Solution code:
x=int(input())
a=[]
for i in range(-119,120):
    for j in range(i+1,120):
        if j**5-i**5==x:
            a.append([j,i])
print(*a[0])

Submission status: Accepted

Solution code:
x = int(input())


def f(a, b):
    return a**5-b**5


divisors = set()
for i in range(1, int(10**9**.5)+1):
    if x % i == 0:
        divisors |= {i, x//i}


for b in range(-1000, 1000):
    for div in divisors:
        a = div+b
        if f(a, b) == x:
            print(a, b)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#abc 166
#d
x = int(input())
n =0
for i in range(-119,120):
    for j in range(-119,120):
        if i**5-j**5 == x:
            print(str(i)+' '+str(j))
            n += 1
            break
        else:
            continue
    if  n !=  0:
        break

Submission status: Accepted

Solution code:
x = int(input())


def f(a, b):
    return a**5-b**5


for a in range(-1000, 1000):
    for b in range(-1000, 1000):
        if f(a, b) == x:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())


def f(a, b):
    return pow(a, 5)-pow(b, 5)


for a in range(-1000, 1000):
    for b in range(-1000, 1000):
        if f(a, b) == x:
            print(a, b)
            exit()

Submission status: Accepted

Solution code:
def f(X):
    for i in range(1, 120):
        for j in range(-63, 119):
            if i**5 - j**5 == X:
                return i, j
X = int(input())
print(*f(X))

Submission status: Accepted

Solution code:
x = int(input())


def checkAndPrint(a, b, x):
    if pow(a, 5) - pow(b, 5) == x:
        print(a, b)
        exit()


for a in range(200):
    for b in range(200):
        checkAndPrint(a, b, x)
        checkAndPrint(-a, b, x)
        checkAndPrint(a, -b, x)

Submission status: Accepted

Solution code:
N=int(input())
K=120
M=2*K+1
ls=[i-K for i in range(M)]
pow5=[n**5 for n in ls]
f=0
for i in range(M):
  for j in range(i,M):
    if pow5[j]-pow5[i]==N:
      print(*[ls[j],ls[i]])
      f=1
      break
  if f==1:
    break

Submission status: Accepted

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