import Data.List

main :: IO ()
main = do
    [a,b,k] <- map read . words <$> getLine :: IO [Int]
    let a' = [ i | i <- [1..a], (a `mod` i) == 0]
        b' = [ i | i <- [1..b], (b `mod` i) == 0]
    print $ (intersect a' b') !! (k - 1)
