main = getLine >>= print . solve . read . head . words solve :: Int -> Int solve n = n `div` f [2..n] where mb = sqrt $ fromIntegral n f [] = n f (x : xs) | mod n x == 0 = x | fromIntegral x < mb = f [y | y <- xs, mod y x /= 0] | otherwise = foldl (\acc y -> if acc == n && mod n y == 0 then y else acc) n xs