object Main extends App {
  var get = readLine
  var a = get.split(" ")(0).toInt
  var b = get.split(" ")(1).toInt
  var c = get.split(" ")(2).toInt
  var sum = 0
  var loop = Math.max(a,b)
  var d = 0
  while(loop > 0 || sum != c) {
    if(a % loop == 0 && b % loop == 0){
      sum += 1
    }
    loop -= 1
  }
		println(loop+1)
}