import java.util.*;

public class Main {

  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    int A = sc.nextInt();
    int B = sc.nextInt();
    int K = sc.nextInt();

    ArrayList divs = new ArrayList();

    for (int i=1; i<=A*B; i++) {
      if (A % i == 0 && B % i == 0) {
        divs.add(i);
      }
    }

    System.out.println(divs.get(divs.size() - K));

  }
} import java.util.*; util.* java public class Main {

  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    int A = sc.nextInt();
    int B = sc.nextInt();
    int K = sc.nextInt();

    ArrayList divs = new ArrayList();

    for (int i=1; i<=A*B; i++) {
      if (A % i == 0 && B % i == 0) {
        divs.add(i);
      }
    }

    System.out.println(divs.get(divs.size() - K));

  }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
    int A = sc.nextInt();
    int B = sc.nextInt();
    int K = sc.nextInt();

    ArrayList divs = new ArrayList();

    for (int i=1; i<=A*B; i++) {
      if (A % i == 0 && B % i == 0) {
        divs.add(i);
      }
    }

    System.out.println(divs.get(divs.size() - K));

  } main {
    int A = sc.nextInt();
    int B = sc.nextInt();
    int K = sc.nextInt();

    ArrayList divs = new ArrayList();

    for (int i=1; i<=A*B; i++) {
      if (A % i == 0 && B % i == 0) {
        divs.add(i);
      }
    }

    System.out.println(divs.get(divs.size() - K));

  } int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc int K = sc.nextInt(); K sc.nextInt() sc.nextInt sc ArrayList divs = new ArrayList(); divs new ArrayList() for (int i=1; i<=A*B; i++) {
      if (A % i == 0 && B % i == 0) {
        divs.add(i);
      }
    } int i=1; int i=1; i 1 i<=A*B i A*B A B i++ i++ i {
      if (A % i == 0 && B % i == 0) {
        divs.add(i);
      }
    } {
      if (A % i == 0 && B % i == 0) {
        divs.add(i);
      }
    } if (A % i == 0 && B % i == 0) {
        divs.add(i);
      } A % i == 0 && B % i == 0 A % i == 0 A % i A i 0 B % i == 0 B % i B i 0 {
        divs.add(i);
      } divs.add(i) divs.add divs i System.out.println(divs.get(divs.size() - K)) System.out.println System.out System System.out divs.get(divs.size() - K) divs.get divs divs.size() - K divs.size() divs.size divs K String[] args args public class Main {

  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    int A = sc.nextInt();
    int B = sc.nextInt();
    int K = sc.nextInt();

    ArrayList divs = new ArrayList();

    for (int i=1; i<=A*B; i++) {
      if (A % i == 0 && B % i == 0) {
        divs.add(i);
      }
    }

    System.out.println(divs.get(divs.size() - K));

  }
} public class Main {

  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    int A = sc.nextInt();
    int B = sc.nextInt();
    int K = sc.nextInt();

    ArrayList divs = new ArrayList();

    for (int i=1; i<=A*B; i++) {
      if (A % i == 0 && B % i == 0) {
        divs.add(i);
      }
    }

    System.out.println(divs.get(divs.size() - K));

  }
} Main
import java.util.*;

public class Main {

  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {
    int A = sc.nextInt();
    int B = sc.nextInt();
    int K = sc.nextInt();

    ArrayList divs = new ArrayList();

    for (int i=1; i<=A*B; i++) {
      if (A % i == 0 && B % i == 0) {
        divs.add(i);
      }
    }

    System.out.println(divs.get(divs.size() - K));

  }
}