"use strict"
function Main(input){
 input=input.trim();
 input=input.split(/\s+/);
 for(let i=0;i<input.length;i++)
   input[i]=input[i]-0;
  var A=input[0];
  var B=input[1];
  var K=input[2];
  var num=0;
  var counter=0;
  while(counter<K){
    num++;
    counter+=(A%num===0&&B%num===0)?1:0;
  }
  console.log(num);
}

Main(require("fs").readFileSync("/dev/stdin","utf8"));