import Control.Applicative
import Data.List
import System.IO

main = do
    end <- isEOF
    if end then return ()
           else do
               getLine >>= putStrLn.unwords.map show.([foldl1 gcd, foldl1 lcm]<*>).flip (:) [].map read.words
               main