inputs = STDIN.readlines.map{|line|line.strip.split()}
line = inputs.shift

a = line[0].to_i
b = line[1].to_i
k = line[2].to_i
i = 0
Range.new(1, 100).each do |n|
    if a % n == 0 && b % n == 0 then
        i += 1
        if i == k then
            puts(n)
            break
        end
    end
end
