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 in Rust (1.42.0) (judge verdict: Accepted)

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);
 
impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

fn pow(i: i64) -> i64 {
    i*i*i*i*i
}

fn f(x: i64, a: i64, b: i64) -> i64 {
    pow(a) - pow(b)
}

fn try_b(x: i64, a: i64) -> Option<i64> {
    let mut b = 0;

//    dbg!(x);
//    dbg!(a);
//    dbg!(b);

    while f(x, a, b) > x {
        b += 1;
    //    dbg!(b);
    }

    while f(x, a, b) < x {
        b -= 1;
   //     dbg!(b);
    }

    if f(x, a, b) == x {
  //      dbg!(b);
        return Some(b);
    };

    return None;
}

fn solve(x: i64) -> (i64, i64) {
    let mut a = 0;
    loop {
        if let Some(b) = try_b(x, a) {
            return (a, b);
        }
        if let Some(b) = try_b(x, -a) {
            return (-a, b);
        }
        a += 1;
    }
}

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let x = sc.read();

    let (a, b) = solve(x);
    println!("{} {}", a, b);
}