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

yakus = [1]
[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97].each do|n|
  while(b % n == 0)
    yakus << n
    b /= n
  end
end
count = 0
yakus.each do|n|
  if a % n == 0
    count += 1
  end
  if count == k
    puts n.to_s
  end
end