import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int bigger = Math.max(A, B);
    int smaller = Math.min(A, B);
    ArrayList<Integer> list = new ArrayList<Integer>();

    for (int i = 1; i <= smaller; i++) {
      if (bigger % i == 0 && smaller % i == 0) {
        list.add(i);
      }
    }
    Collections.sort(list, Collections.reverseOrder());
    System.out.println(list.get(C - 1));
  }
} import java.util.Scanner; Scanner java.util import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int bigger = Math.max(A, B);
    int smaller = Math.min(A, B);
    ArrayList<Integer> list = new ArrayList<Integer>();

    for (int i = 1; i <= smaller; i++) {
      if (bigger % i == 0 && smaller % i == 0) {
        list.add(i);
      }
    }
    Collections.sort(list, Collections.reverseOrder());
    System.out.println(list.get(C - 1));
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int bigger = Math.max(A, B);
    int smaller = Math.min(A, B);
    ArrayList<Integer> list = new ArrayList<Integer>();

    for (int i = 1; i <= smaller; i++) {
      if (bigger % i == 0 && smaller % i == 0) {
        list.add(i);
      }
    }
    Collections.sort(list, Collections.reverseOrder());
    System.out.println(list.get(C - 1));
  } main {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int bigger = Math.max(A, B);
    int smaller = Math.min(A, B);
    ArrayList<Integer> list = new ArrayList<Integer>();

    for (int i = 1; i <= smaller; i++) {
      if (bigger % i == 0 && smaller % i == 0) {
        list.add(i);
      }
    }
    Collections.sort(list, Collections.reverseOrder());
    System.out.println(list.get(C - 1));
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc int C = sc.nextInt(); C sc.nextInt() sc.nextInt sc int bigger = Math.max(A, B); bigger Math.max(A, B) Math.max Math A B int smaller = Math.min(A, B); smaller Math.min(A, B) Math.min Math A B ArrayList<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() for (int i = 1; i <= smaller; i++) {
      if (bigger % i == 0 && smaller % i == 0) {
        list.add(i);
      }
    } int i = 1; int i = 1; i 1 i <= smaller i smaller i++ i++ i {
      if (bigger % i == 0 && smaller % i == 0) {
        list.add(i);
      }
    } {
      if (bigger % i == 0 && smaller % i == 0) {
        list.add(i);
      }
    } if (bigger % i == 0 && smaller % i == 0) {
        list.add(i);
      } bigger % i == 0 && smaller % i == 0 bigger % i == 0 bigger % i bigger i 0 smaller % i == 0 smaller % i smaller i 0 {
        list.add(i);
      } list.add(i) list.add list i Collections.sort(list, Collections.reverseOrder()) Collections.sort Collections list Collections.reverseOrder() Collections.reverseOrder Collections System.out.println(list.get(C - 1)) System.out.println System.out System System.out list.get(C - 1) list.get list C - 1 C 1 String[] args args public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int bigger = Math.max(A, B);
    int smaller = Math.min(A, B);
    ArrayList<Integer> list = new ArrayList<Integer>();

    for (int i = 1; i <= smaller; i++) {
      if (bigger % i == 0 && smaller % i == 0) {
        list.add(i);
      }
    }
    Collections.sort(list, Collections.reverseOrder());
    System.out.println(list.get(C - 1));
  }
} public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int bigger = Math.max(A, B);
    int smaller = Math.min(A, B);
    ArrayList<Integer> list = new ArrayList<Integer>();

    for (int i = 1; i <= smaller; i++) {
      if (bigger % i == 0 && smaller % i == 0) {
        list.add(i);
      }
    }
    Collections.sort(list, Collections.reverseOrder());
    System.out.println(list.get(C - 1));
  }
} Main
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int bigger = Math.max(A, B);
    int smaller = Math.min(A, B);
    ArrayList<Integer> list = new ArrayList<Integer>();

    for (int i = 1; i <= smaller; i++) {
      if (bigger % i == 0 && smaller % i == 0) {
        list.add(i);
      }
    }
    Collections.sort(list, Collections.reverseOrder());
    System.out.println(list.get(C - 1));
  }
}
