import Control.Monad

main = do
    getLine -- dummy
    
    nsStr <- getLine
    let ns = (map read (words nsStr)) :: [Int]
    let n = if (length ns) == 2
        then gcd (ns!!0) (ns!!1)
        else gcd (gcd (ns!!0) (ns!!1)) (ns!!2)
    
    let sr = floor (sqrt (fromIntegral n)) :: Int
    
    let factor1 = filter (\i -> (mod n i) == 0) [1..sr]
    let factor2 = reverse (map (\i -> div n i) factor1)
    let factor2b = if (head factor2) == sr then drop 1 factor2 else factor2
    forM_ factor1 (\i -> do putStrLn (show i))
    forM_ factor2b (\i -> do putStrLn (show i))

