i=j=x=int(eval(input()))

while i**5-j**5-x:i=-~i%120;j=-~j%217-98

print((i,j))
i=j=x=int(eval(input()))

while i**5-j**5-x:i=-~i%120;j=j%221-99

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

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

-    j = -~j % 217 - 98 +    j = j % 221 - 99