m=5**6

exec(f'i,j=m%128,m>>7;m-=i**5-j**5!={input()}or exit(print(i,j));'*2*m)
i=j=x=int(eval(input()))

while(i:=-~i%127)**5-j**5-x:j=j%257-i

print((i,j))
m = 5**6
exec(f"i,j=m%128,m>>7;m-=i**5-j**5!={input()}or exit(print(i,j));" * 2 * m)

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

-m = 5**6 -exec(f"i,j=m%128,m>>7;m-=i**5-j**5!={input()}or exit(print(i,j));" * 2 * m) +i = j = x = int(eval(input())) +while (i := -~i % 127) ** 5 - j**5 - x: +    j = j % 257 - i +print((i, j))