require 'prime'
a,b,c=gets.split.map &:to_i
class Integer
  def my_divisor_list
    divisors,primes=[1],[]
    Prime.prime_division(self).each do |prime|
      prime[1].times {primes<< prime[0]}
    end
    1.upto(primes.size) do |i|;primes.combination(i) do |prime|
      divisors<< prime.inject{|a,b|a*=b}
    end;end
    divisors.uniq!.sort!
    return divisors
  rescue ZeroDivisionError
    return
  end
end
begin
p (a.my_divisor_list&b.my_divisor_list).reverse[c-1]
rescue;p 1;end