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

  def divisor_list
    return [1] if self == 1
    (1..Math.sqrt(self).to_i).select do |i|
      self%i == 0
    end.map {|e| [e, self/e]}.flatten.uniq.sort
  end

end
p (a.divisor_list & b.divisor_list)[-k]
