require 'prime'

a,b,k = gets.split.map(&:to_i)

primes = Prime.prime_division(a.gcd(b)).map do |n, p|
  [n]*p
end.flatten


divisors = (1..primes.size).to_a.map do |n|
  primes.combination(n).map do |arr|
    arr.inject(:*)
  end
end.flatten + [1]

puts divisors.uniq.sort.reverse.at(k-1)
