AtCoder Beginner Contest 166 - I hate Factorization

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

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

Examples

Input

33


Output

2 -1


Input

1


Output

0 -1

Source: atcoder | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
x = int(input())
for a in range(999):
	for b in range(-a, a):
		if a ** 5 - b ** 5 == x:
			print(a, b)
			exit()


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


n = int(input())
for i in range(1, 121):
	for j in range(-121, 121):
		if i ** 5 - j ** 5 == n:
			print(i, j)
			exit()


from sys import exit
x = int(input())
for i in range(0, 201):
	for j in range(-200, i):
		if i ** 5 - j ** 5 == x:
			print(i, j)
			exit()


exec('x=int(input());i=0;' + 'j=-i;exec("i**5-x-j**5or exit(print(i,j));j+=1;"*i*2);i+=1;' * 200)


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


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


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


x = int(input())
for i in range(-120, 121):
	for j in range(-120, 121):
		if pow(i, 5) - pow(j, 5) == x:
			print(i, j)
			exit()


X = int(input())
for a in range(-200, 201):
	for b in range(-200, 201):
		if a ** 5 - b ** 5 == X:
			print(a, b)
			exit()


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


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


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


n = int(input())
for i in range(-118, 120):
	for j in range(-118, 120):
		if pow(i, 5) - pow(j, 5) == n:
			print(i, j)
			quit()


from itertools import product
X = int(input())
for (a, b) in product(range(-200, 201), repeat=2):
	if a ** 5 - b ** 5 == X:
		print(a, b)
		break


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


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()


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


x = int(input())
for A in range(-200, 200):
	for B in range(-200, 200):
		if A ** 5 - B ** 5 == x:
			print(str(A) + ' ' + str(B))
			exit()


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


target = int(input())
for A in range(-118, 120):
	for B in range(-119, 119):
		if target == A ** 5 - B ** 5:
			print(f'{A} {B}')
			exit(0)


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


A = int(input())
for i in range(-119, 119):
	for j in range(-119, 119):
		if i ** 5 - j ** 5 == A:
			print(i, j)
			exit()


x = int(input())
a = 0
b = -64
while True:
	t = a ** 5 - b ** 5
	if t == x:
		break
	if t > x:
		b += 1
	else:
		a += 1
print(a, b)


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


x = int(input())
i = j = c = 5 ** 6
while i ** 5 - j ** 5 - x:
	c -= 1
	i = c % 128
	j = c >> 7
print(i, j)


x = int(input())
for a in range(-150, 150):
	for b in range(-150, 150):
		if a ** 5 - b ** 5 == x:
			ans = (a, b)
print(*ans)


x = int(input())
for i in range(-118, 119):
	for j in range(-119, 118):
		if i ** 5 - j ** 5 == x:
			print(i, j)
			quit()


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])


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


i = 0
exec('j=-i;exec("i**5-%s-j**5or exit(print(i,j));j+=1;"*i*2);i+=1;' % input() * 200)


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()


x = int(input())
for a in range(-200, 201):
	f = False
	for b in range(-201, 201):
		if a ** 5 - b ** 5 == x:
			print(a, b)
			f = True
			break
	if f:
		break


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


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()


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


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


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


i = j = x = int(input())
while i ** 5 - j ** 5 - x:
	i = -~i % 120
	j = j % 221 - 99
print(i, j)


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()


import sys
X = int(input())
for i in range(10 ** 3):
	for k in range(-10 ** 3, 10 ** 3):
		if i ** 5 - k ** 5 == X:
			print(i, k)
			sys.exit()


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


from sys import exit
x = int(input())
for a in range(-200, 201):
	for b in range(-200, 201):
		if a ** 5 - b ** 5 == x:
			print(a, b)
			exit()


x = int(input())
for i in range(-150, 151):
	for j in range(-150, 151):
		if pow(i, 5) - pow(j, 5) == x:
			print(i, j)
			exit()


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


X = int(input())
List = [(A, B) for A in range(-120, 120) for B in range(-120, 120) if A ** 5 - B ** 5 == X]
print(*List[0])


def f(x):
	return x * x * x * x * x
n = int(input())
for i in range(-500, 500):
	for j in range(-500, 500):
		if f(i) - f(j) == n:
			print(i, j)
			exit()


x = int(input())
r = range(-99, 200)
[i ** 5 - x - j ** 5 or exit(print(i, j)) for i in r for j in r]


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()


x = int(input())
for a in range(1, 120):
	for b in range(-65, 119):
		if a ** 5 - b ** 5 == x:
			print(a, b)
			exit()


i = j = x = int(input())
while i ** 5 - j ** 5 - x:
	i = -~i % 127
	j = j % 257 - i
print(i, j)


X = int(input())
Z = 300
for a in range(-Z, Z):
	for b in range(-Z, Z):
		if a ** 5 - b ** 5 == X:
			print(a, b)
			exit()


i = j = x = int(input())
while i ** 5 - j ** 5 - x:
	i = -~i % 120
	j = (j + 99) % 217 - 98
print(i, j)


X = int(input())
I = J = 0
for i in range(-300, 300):
	for j in range(-300, 300):
		if i ** 5 - j ** 5 == X:
			I = i
			J = j
			break
print(I, J)


import math
x = int(input())
for i in range(120):
	for j in range(-54, i):
		if math.pow(i, 5) - math.pow(j, 5) == x:
			print(i, j)
			exit()


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


X = int(input())
for a in range(3 * 10 ** 2):
	for b in range(6 * 10 ** 2):
		if a ** 5 - (b - 300) ** 5 == X:
			print(a, b - 300)
			exit()


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


x = int(input())
i = 1
a = 0
b = 0
while a == 0 and b == 0:
	for j in range(-i, i):
		if i ** 5 - j ** 5 == x:
			a = i
			b = j
	i += 1
print(a, b)


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


X = int(input())
f = {}
for a in range(200):
	for b in range(-200, 200):
		f[a ** 5 - b ** 5] = [a, b]
(A, B) = f[X]
print(A, B)


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


X = int(input())
B = 0
for i in range(-118, 120):
	for j in range(-119, 119):
		if X == i ** 5 - j ** 5:
			print(i, j)
			exit()


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


x = int(input())
d = dict()
for i in range(-200, 201):
	d[i ** 5] = i
for i in d:
	if x + i in d:
		print(d[x + i], d[i])
		break


import math
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()


x = int(input())
d = {}
for a in range(-200, 200):
	for b in range(-200, 200):
		k = a ** 5 - b ** 5
		d[k] = [a, b]
print(*d[x])


n = int(input())
for a in range(500):
	for b in range(-500, 500):
		if a ** 5 - b ** 5 == n:
			print(a, b)
			exit()


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
print(*[A, B])


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()


X = int(input())
for a in range(10 ** 4):
	for b in range(10 ** 4):
		if a ** 5 - b ** 5 == X:
			print(a, b)
			exit()
		elif a ** 5 + b ** 5 == X:
			print(a, -b)
			exit()


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


X = int(input())
for a in range(-118, 120):
	for b in range(-118, a + 1):
		if a ** 5 - b ** 5 == X:
			print('%s %s' % (a, b))
			exit()


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


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


X = int(input())
for a in range(-201, 201):
	for b in range(-201, 201):
		if a ** 5 - b ** 5 == X:
			print(a, b)
			quit()


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


x = int(input())
for a in range(10000):
	for b in range(-5000, 5000):
		if a ** 5 - b ** 5 == x:
			print(a, b)
			exit()


X = int(input())
for a in range(200):
	for b in range(-100, 200):
		if a ** 5 - b ** 5 == X:
			res = (a, b)
print(*res)


import math
x = int(input())
for a in range(-300, 300):
	for b in range(-300, 300):
		if a ** 5 - b ** 5 == x:
			print(a, b)
			exit()


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


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()