import Control.Applicative
import Data.List
import Data.Char

readInts :: IO [Integer]
readInts = map read . words <$> getLine

strip :: String -> String
strip = reverse . dropWhile isSpace . reverse . dropWhile isSpace

ints :: String -> [Integer]
ints = map read . words

prn :: Show a => a -> IO ()
prn = putStrLn . show

prns :: Show a => [a] -> IO ()
prns = putStrLn . unwords . map show

calc :: [Integer] -> [Integer]
calc xs = [gcd a b, lcm a b]
  where
    a = xs !! 0
    b = xs !! 1

main :: IO ()
main = do
  s <- getContents
  let xs = map ints $ lines $ strip s :: [[Integer]]
  mapM_ prns $ map calc xs