import Control.Applicative ((<$>)) import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as B import Data.Bits ((.&.)) main :: IO () main = do solve <$> getl (readi B.readInt) >>= putStrLn solve :: Int -> String solve x = f 1 (x - 1) where f a b | b == 0 = "-1" | isp2 a || isp2 b = f (a + 1) (b - 1) | otherwise = show a ++ " " ++ show b isp2 :: Int -> Bool isp2 x = f 0 x == 1 where f c n | n == 0 = c | otherwise = f (c + 1) (n .&. (n - 1)) getl :: (ByteString -> a) -> IO a getl f = f <$> B.getLine readi :: Integral a => (ByteString -> Maybe (a, ByteString)) -> ByteString -> a readi f s = let Just (n, _) = f s in n