object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val A, B, K = sc.nextInt()

    println((for {
      i <- 1 to Math.min(A, B)
      if A % i == 0 && B % i == 0
    } yield i).toArray.sorted(Ordering.Int.reverse).apply(K - 1))
  }

}

