module IntMap = Map.Make (struct
  type t = int
  let compare = compare
end)


let () = Scanf.scanf "%d" @@ fun n ->
  let rec pow5s acc i =
    if n < i * i * i * i
    then acc
    else pow5s (IntMap.add (i * i * i * i * i) i acc) (i + 1) in
  let pow5s = pow5s IntMap.empty 0 in
  let Some (a, b) =
    IntMap.fold (fun pow5a a ans ->
      match IntMap.find_opt (abs (pow5a - n)) pow5s with
      | None -> ans
      | Some b -> Some (a, if pow5a - n <= 0 then ~- b else b)) pow5s None in
  Printf.printf "%d %d\n" a b


