import java.util.Scanner

object Main {
  def main(args: Array[String]) = {
    val sc = new Scanner(System.in)
    val A, B, K = sc.nextInt()

    val min = A.min(B)
    val a = 1.until(min + 1).foldRight(List.empty[Int]) {
      (index, pre) =>
        if (A % index == 0 && B % index == 0) index :: pre else pre
    }
    println(a.reverse(K-1))
  }

}
