import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  x <- unsafeTextToInt <$> T.getLine :: IO Int
  let
    fs = factors x :: [Int]
    as = takeWhile ((<= x) . (^ 4)) [0..] :: [Int]
    abs = g <$> as <*> fs :: [(Int, Int)]
      where
        g :: Int -> Int -> (Int, Int)
        g a f = (a, a - f)
    p :: (Int, Int) -> Bool
    p (a, b) = a ^ 5 - b ^ 5 == x
  ((>>) <$> putStr . show . fst <*> putStrLn . (' ' :) . show . snd) . head . filter p $ abs

factors :: Int -> [Int]
factors n = factors' [] 1
  where
    factors' :: [Int] -> Int -> [Int]
    factors' ts d | q < d     = ts
                  | r /= 0    = factors' ts (succ d)
                  | d < q     = d : factors' (q : ts) (succ d)
                  | otherwise = d : ts
      where
        (q, r) = n `divMod` d

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
