main :: IO()
main = getContents >>= mapM_ (putStrLn . unwords . map show . (\[x, y] -> [gcd x y, lcm x y])) . (mapMap read . wordsLines)

wordsLines :: String -> [[String]]
wordsLines = map words . lines

mapMap :: (a -> b) -> [[a]] -> [[b]]
mapMap f = map (map f)
