import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int[] a = new int[100];
            int k = 0;
            for (int n = 1; n <= 100; n++) {
                if (A % n == 0 && B % n == 0) {
                    a[k] = n;
                    k++;
                }
            }

            for (int i = 0; i < K; i++) {
                k--;
            }

//            Utils.debug(a, k, K);
            System.out.println(a[k]);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int[] a = new int[100];
            int k = 0;
            for (int n = 1; n <= 100; n++) {
                if (A % n == 0 && B % n == 0) {
                    a[k] = n;
                    k++;
                }
            }

            for (int i = 0; i < K; i++) {
                k--;
            }

//            Utils.debug(a, k, K);
            System.out.println(a[k]);
        }
    }
} Main public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int[] a = new int[100];
            int k = 0;
            for (int n = 1; n <= 100; n++) {
                if (A % n == 0 && B % n == 0) {
                    a[k] = n;
                    k++;
                }
            }

            for (int i = 0; i < K; i++) {
                k--;
            }

//            Utils.debug(a, k, K);
            System.out.println(a[k]);
        }
    } main {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int[] a = new int[100];
            int k = 0;
            for (int n = 1; n <= 100; n++) {
                if (A % n == 0 && B % n == 0) {
                    a[k] = n;
                    k++;
                }
            }

            for (int i = 0; i < K; i++) {
                k--;
            }

//            Utils.debug(a, k, K);
            System.out.println(a[k]);
        }
    } try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int[] a = new int[100];
            int k = 0;
            for (int n = 1; n <= 100; n++) {
                if (A % n == 0 && B % n == 0) {
                    a[k] = n;
                    k++;
                }
            }

            for (int i = 0; i < K; i++) {
                k--;
            }

//            Utils.debug(a, k, K);
            System.out.println(a[k]);
        } {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int[] a = new int[100];
            int k = 0;
            for (int n = 1; n <= 100; n++) {
                if (A % n == 0 && B % n == 0) {
                    a[k] = n;
                    k++;
                }
            }

            for (int i = 0; i < K; i++) {
                k--;
            }

//            Utils.debug(a, k, K);
            System.out.println(a[k]);
        } Scanner in = new Scanner(System.in) Scanner in = new Scanner(System.in) new Scanner(System.in) int A = in.nextInt(); A in.nextInt() in.nextInt in int B = in.nextInt(); B in.nextInt() in.nextInt in int K = in.nextInt(); K in.nextInt() in.nextInt in int[] a = new int[100]; a new int[100] 100 int k = 0; k 0 for (int n = 1; n <= 100; n++) {
                if (A % n == 0 && B % n == 0) {
                    a[k] = n;
                    k++;
                }
            } int n = 1; int n = 1; n 1 n <= 100 n 100 n++ n++ n {
                if (A % n == 0 && B % n == 0) {
                    a[k] = n;
                    k++;
                }
            } {
                if (A % n == 0 && B % n == 0) {
                    a[k] = n;
                    k++;
                }
            } if (A % n == 0 && B % n == 0) {
                    a[k] = n;
                    k++;
                } A % n == 0 && B % n == 0 A % n == 0 A % n A n 0 B % n == 0 B % n B n 0 {
                    a[k] = n;
                    k++;
                } a[k] = n a[k] a k n k++ k for (int i = 0; i < K; i++) {
                k--;
            } int i = 0; int i = 0; i 0 i < K i K i++ i++ i {
                k--;
            } {
                k--;
            } k-- k System.out.println(a[k]) System.out.println System.out System System.out a[k] a k String args[] args public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int[] a = new int[100];
            int k = 0;
            for (int n = 1; n <= 100; n++) {
                if (A % n == 0 && B % n == 0) {
                    a[k] = n;
                    k++;
                }
            }

            for (int i = 0; i < K; i++) {
                k--;
            }

//            Utils.debug(a, k, K);
            System.out.println(a[k]);
        }
    }
} public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int[] a = new int[100];
            int k = 0;
            for (int n = 1; n <= 100; n++) {
                if (A % n == 0 && B % n == 0) {
                    a[k] = n;
                    k++;
                }
            }

            for (int i = 0; i < K; i++) {
                k--;
            }

//            Utils.debug(a, k, K);
            System.out.println(a[k]);
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int[] a = new int[100];
            int k = 0;
            for (int n = 1; n <= 100; n++) {
                if (A % n == 0 && B % n == 0) {
                    a[k] = n;
                    k++;
                }
            }

            for (int i = 0; i < K; i++) {
                k--;
            }

//            Utils.debug(a, k, K);
            System.out.println(a[k]);
        }
    }
}
