Scanf.scanf "%d" (fun x ->
    let check x i =
        let rec loop c =
            if c < -1000 then None else
                if c * c * c * c * c - (c - i) * (c - i) * (c - i) * (c - i) * (c - i) = x then Some (c, c - i)
                else loop (c - 1)
        in
        loop 1000
    in
    let rec loop i =
        if x mod i = 0 then (
            match check x i with
            | Some (a, b) -> Printf.printf "%d %d\n" a b
            | None -> loop (i + 1)
        ) else loop (i + 1)
    in
    loop 1
)