function main(arg) {
    
   a = arg.split(" ");
   x = a[0];
   y = a[1];
   z = a[2];
   incr = 0;
   
       for(var i=1; i<= x*z; i++){
           
           if(x%i === 0 && y%i === 0){
               
             incr++;
             if(incr == z){console.log(i);}
             
            }
       }
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));