// b
const solve = (inputs) => {
  const input = inputs.split("\n");
  const nums = input[0].split(' ').map((e)=>parseInt(e));

  let k = 0;
  for(let i = 100;i >= 0; --i) {
    if ((nums[0] % i == 0) && (nums[1] % i == 0)) ++k;

    if (k == nums[2]) {
      console.log('%d',i);
      break;
    }
  }
}

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