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

def divisor(n)
  array = []
  i = 1
  while i*i <= n do
    if n%i == 0
      array.push(i)
      if i != 1 && i*i != n
        array.push(n/i)
      end
    end
    i += 1
  end
  return array
end
a_a = divisor(a)
b_b = divisor(b)
ans = a_a & b_b
puts ans[k-1]