import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int val1 = sc.nextInt();
        int val2 = sc.nextInt();
        int val3 = sc.nextInt();

        List<Integer> k = new ArrayList<>();
        int loop = val1 > val2 ? val1 : val2;
        for (int i = 1; i <= loop; i++) {
            if ((val1 % i == 0) && (val2 % i == 0)) {
                k.add(i);
            }
        }
        Collections.sort(k);
        System.out.println(k.get((k.size() - 1) - (val3 - 1)));
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int val1 = sc.nextInt();
        int val2 = sc.nextInt();
        int val3 = sc.nextInt();

        List<Integer> k = new ArrayList<>();
        int loop = val1 > val2 ? val1 : val2;
        for (int i = 1; i <= loop; i++) {
            if ((val1 % i == 0) && (val2 % i == 0)) {
                k.add(i);
            }
        }
        Collections.sort(k);
        System.out.println(k.get((k.size() - 1) - (val3 - 1)));
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int val1 = sc.nextInt();
        int val2 = sc.nextInt();
        int val3 = sc.nextInt();

        List<Integer> k = new ArrayList<>();
        int loop = val1 > val2 ? val1 : val2;
        for (int i = 1; i <= loop; i++) {
            if ((val1 % i == 0) && (val2 % i == 0)) {
                k.add(i);
            }
        }
        Collections.sort(k);
        System.out.println(k.get((k.size() - 1) - (val3 - 1)));
    } main {
        Scanner sc = new Scanner(System.in);

        int val1 = sc.nextInt();
        int val2 = sc.nextInt();
        int val3 = sc.nextInt();

        List<Integer> k = new ArrayList<>();
        int loop = val1 > val2 ? val1 : val2;
        for (int i = 1; i <= loop; i++) {
            if ((val1 % i == 0) && (val2 % i == 0)) {
                k.add(i);
            }
        }
        Collections.sort(k);
        System.out.println(k.get((k.size() - 1) - (val3 - 1)));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int val1 = sc.nextInt(); val1 sc.nextInt() sc.nextInt sc int val2 = sc.nextInt(); val2 sc.nextInt() sc.nextInt sc int val3 = sc.nextInt(); val3 sc.nextInt() sc.nextInt sc List<Integer> k = new ArrayList<>(); k new ArrayList<>() int loop = val1 > val2 ? val1 : val2; loop val1 > val2 ? val1 : val2 val1 > val2 val1 val2 val1 val2 for (int i = 1; i <= loop; i++) {
            if ((val1 % i == 0) && (val2 % i == 0)) {
                k.add(i);
            }
        } int i = 1; int i = 1; i 1 i <= loop i loop i++ i++ i {
            if ((val1 % i == 0) && (val2 % i == 0)) {
                k.add(i);
            }
        } {
            if ((val1 % i == 0) && (val2 % i == 0)) {
                k.add(i);
            }
        } if ((val1 % i == 0) && (val2 % i == 0)) {
                k.add(i);
            } (val1 % i == 0) && (val2 % i == 0) (val1 % i == 0) val1 % i val1 i 0 (val2 % i == 0) val2 % i val2 i 0 {
                k.add(i);
            } k.add(i) k.add k i Collections.sort(k) Collections.sort Collections k System.out.println(k.get((k.size() - 1) - (val3 - 1))) System.out.println System.out System System.out k.get((k.size() - 1) - (val3 - 1)) k.get k (k.size() - 1) - (val3 - 1) (k.size() - 1) k.size() k.size k 1 (val3 - 1) val3 1 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int val1 = sc.nextInt();
        int val2 = sc.nextInt();
        int val3 = sc.nextInt();

        List<Integer> k = new ArrayList<>();
        int loop = val1 > val2 ? val1 : val2;
        for (int i = 1; i <= loop; i++) {
            if ((val1 % i == 0) && (val2 % i == 0)) {
                k.add(i);
            }
        }
        Collections.sort(k);
        System.out.println(k.get((k.size() - 1) - (val3 - 1)));
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int val1 = sc.nextInt();
        int val2 = sc.nextInt();
        int val3 = sc.nextInt();

        List<Integer> k = new ArrayList<>();
        int loop = val1 > val2 ? val1 : val2;
        for (int i = 1; i <= loop; i++) {
            if ((val1 % i == 0) && (val2 % i == 0)) {
                k.add(i);
            }
        }
        Collections.sort(k);
        System.out.println(k.get((k.size() - 1) - (val3 - 1)));
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int val1 = sc.nextInt();
        int val2 = sc.nextInt();
        int val3 = sc.nextInt();

        List<Integer> k = new ArrayList<>();
        int loop = val1 > val2 ? val1 : val2;
        for (int i = 1; i <= loop; i++) {
            if ((val1 % i == 0) && (val2 % i == 0)) {
                k.add(i);
            }
        }
        Collections.sort(k);
        System.out.println(k.get((k.size() - 1) - (val3 - 1)));
    }
}