factors :: Integral a => a -> [a] factors n = [f | f <- [1 .. n], mod n f == 0] main :: IO () main = print . (\n -> div n $ flip (!!) 1 $ factors n) . head . map read . words =<< getLine