import           Control.Applicative
import           Control.Monad
import           Data.List
import           Text.Printf

main :: IO ()
main = (mapM_ (sovle . map (read :: String -> Int) . words) . lines) =<< getContents
  where
    sovle [a,b] = putStrLn $ unwords $ map show [gcd' a b, lcm' a b]
    gcd' a 0 = a
    gcd' a b = gcd' b (a `rem` b)
    lcm' 0 0 = 0
    lcm' a b = a `div` (gcd' a b) * b
