class Integer
  def divisor_list
    devisors = [1]
    2.upto(self/2) do |i|
      devisors << i if self%i == 0
    end
    devisors << self
    return devisors
  end
end

datas = gets.split(" ").map{|nn|nn.to_i}
a = datas[0]
b = datas[1]
k = datas[2]

yakus = b.divisor_list.reverse
count = 0
yakus.each do|n|
  if a % n == 0
    count += 1
  end
  if count == k
    puts n.to_s
    count = -1000
  end
end