gcm :: Int -> Int -> Int
gcm a b | a < b     = gcm b a
        | b == 0    = a
        | otherwise = gcm b (a`mod`b)

lcm' :: Int -> Int -> Int
lcm' a b = (a * b) `div` (gcm a b)

solv :: String -> String
solv s = (show $ gcm a b) ++ " " ++ (show $ lcm' a b)
  where (a:b:_) = map read . words $ s

main = interact (unlines.map solv.lines)