import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int numA = sc.nextInt();
        int numB = sc.nextInt();
        int numC = sc.nextInt();
        List<Integer> numAList = getNums(numA);
        List<Integer> numBList = getNums(numB);

        List<Integer> commonList = new ArrayList<>();
        for (int num : numAList) {
            if (numBList.contains(num)) {
                commonList.add(num);
            }
        }
        commonList.sort(Comparator.reverseOrder());
        System.out.println(commonList.get(numC- 1));
    }

    public static List<Integer> getNums(int num) {
        List<Integer> numList = new LinkedList<>();
        for (int n = 1; n <= num; n++) {
            if (num % n == 0) {
                numList.add(n);
            }
        }
        return numList;
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int numA = sc.nextInt();
        int numB = sc.nextInt();
        int numC = sc.nextInt();
        List<Integer> numAList = getNums(numA);
        List<Integer> numBList = getNums(numB);

        List<Integer> commonList = new ArrayList<>();
        for (int num : numAList) {
            if (numBList.contains(num)) {
                commonList.add(num);
            }
        }
        commonList.sort(Comparator.reverseOrder());
        System.out.println(commonList.get(numC- 1));
    }

    public static List<Integer> getNums(int num) {
        List<Integer> numList = new LinkedList<>();
        for (int n = 1; n <= num; n++) {
            if (num % n == 0) {
                numList.add(n);
            }
        }
        return numList;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int numA = sc.nextInt();
        int numB = sc.nextInt();
        int numC = sc.nextInt();
        List<Integer> numAList = getNums(numA);
        List<Integer> numBList = getNums(numB);

        List<Integer> commonList = new ArrayList<>();
        for (int num : numAList) {
            if (numBList.contains(num)) {
                commonList.add(num);
            }
        }
        commonList.sort(Comparator.reverseOrder());
        System.out.println(commonList.get(numC- 1));
    } main {
        Scanner sc = new Scanner(System.in);
        int numA = sc.nextInt();
        int numB = sc.nextInt();
        int numC = sc.nextInt();
        List<Integer> numAList = getNums(numA);
        List<Integer> numBList = getNums(numB);

        List<Integer> commonList = new ArrayList<>();
        for (int num : numAList) {
            if (numBList.contains(num)) {
                commonList.add(num);
            }
        }
        commonList.sort(Comparator.reverseOrder());
        System.out.println(commonList.get(numC- 1));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int numA = sc.nextInt(); numA sc.nextInt() sc.nextInt sc int numB = sc.nextInt(); numB sc.nextInt() sc.nextInt sc int numC = sc.nextInt(); numC sc.nextInt() sc.nextInt sc List<Integer> numAList = getNums(numA); numAList getNums(numA) getNums numA List<Integer> numBList = getNums(numB); numBList getNums(numB) getNums numB List<Integer> commonList = new ArrayList<>(); commonList new ArrayList<>() for (int num : numAList) {
            if (numBList.contains(num)) {
                commonList.add(num);
            }
        } int num numAList {
            if (numBList.contains(num)) {
                commonList.add(num);
            }
        } {
            if (numBList.contains(num)) {
                commonList.add(num);
            }
        } if (numBList.contains(num)) {
                commonList.add(num);
            } numBList.contains(num) numBList.contains numBList num {
                commonList.add(num);
            } commonList.add(num) commonList.add commonList num commonList.sort(Comparator.reverseOrder()) commonList.sort commonList Comparator.reverseOrder() Comparator.reverseOrder Comparator System.out.println(commonList.get(numC- 1)) System.out.println System.out System System.out commonList.get(numC- 1) commonList.get commonList numC- 1 numC 1 String[] args args public static List<Integer> getNums(int num) {
        List<Integer> numList = new LinkedList<>();
        for (int n = 1; n <= num; n++) {
            if (num % n == 0) {
                numList.add(n);
            }
        }
        return numList;
    } getNums {
        List<Integer> numList = new LinkedList<>();
        for (int n = 1; n <= num; n++) {
            if (num % n == 0) {
                numList.add(n);
            }
        }
        return numList;
    } List<Integer> numList = new LinkedList<>(); numList new LinkedList<>() for (int n = 1; n <= num; n++) {
            if (num % n == 0) {
                numList.add(n);
            }
        } int n = 1; int n = 1; n 1 n <= num n num n++ n++ n {
            if (num % n == 0) {
                numList.add(n);
            }
        } {
            if (num % n == 0) {
                numList.add(n);
            }
        } if (num % n == 0) {
                numList.add(n);
            } num % n == 0 num % n num n 0 {
                numList.add(n);
            } numList.add(n) numList.add numList n return numList; numList int num num public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int numA = sc.nextInt();
        int numB = sc.nextInt();
        int numC = sc.nextInt();
        List<Integer> numAList = getNums(numA);
        List<Integer> numBList = getNums(numB);

        List<Integer> commonList = new ArrayList<>();
        for (int num : numAList) {
            if (numBList.contains(num)) {
                commonList.add(num);
            }
        }
        commonList.sort(Comparator.reverseOrder());
        System.out.println(commonList.get(numC- 1));
    }

    public static List<Integer> getNums(int num) {
        List<Integer> numList = new LinkedList<>();
        for (int n = 1; n <= num; n++) {
            if (num % n == 0) {
                numList.add(n);
            }
        }
        return numList;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int numA = sc.nextInt();
        int numB = sc.nextInt();
        int numC = sc.nextInt();
        List<Integer> numAList = getNums(numA);
        List<Integer> numBList = getNums(numB);

        List<Integer> commonList = new ArrayList<>();
        for (int num : numAList) {
            if (numBList.contains(num)) {
                commonList.add(num);
            }
        }
        commonList.sort(Comparator.reverseOrder());
        System.out.println(commonList.get(numC- 1));
    }

    public static List<Integer> getNums(int num) {
        List<Integer> numList = new LinkedList<>();
        for (int n = 1; n <= num; n++) {
            if (num % n == 0) {
                numList.add(n);
            }
        }
        return numList;
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int numA = sc.nextInt();
        int numB = sc.nextInt();
        int numC = sc.nextInt();
        List<Integer> numAList = getNums(numA);
        List<Integer> numBList = getNums(numB);

        List<Integer> commonList = new ArrayList<>();
        for (int num : numAList) {
            if (numBList.contains(num)) {
                commonList.add(num);
            }
        }
        commonList.sort(Comparator.reverseOrder());
        System.out.println(commonList.get(numC- 1));
    }

    public static List<Integer> getNums(int num) {
        List<Integer> numList = new LinkedList<>();
        for (int n = 1; n <= num; n++) {
            if (num % n == 0) {
                numList.add(n);
            }
        }
        return numList;
    }
}