module Main where
 
import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Text.Printf

main :: IO ()
main = do
    -- _ <- getLine
    ns <- fmap (fmap (read :: String -> Int) . words) . lines <$> getContents
    -- ns <- fmap (fmap (read :: String -> Int) . words) . lines <$> (return "8 6\n50000000 30000000\n1999999999 2000000000\n")
    forM_ [0..length ns-1] $ \i -> do
      let (x,y) = ((ns!!i)!!0, (ns!!i)!!1)
      printf "%d %d\n" (gcd x y) (lcm x y)