import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int a = in.nextInt();
        int b = in.nextInt();
        int k = in.nextInt();

        int count = 0;
        int x = a < b ? a : b;
        for (int i = 1; i <= x; i++) {
            if (a % i == 0 && b % i == 0) {
                sb.append(i + "_");
                count++;
            }
        }
        String ans = sb.toString();
        System.out.println(ans.split("_")[count-k]);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int a = in.nextInt();
        int b = in.nextInt();
        int k = in.nextInt();

        int count = 0;
        int x = a < b ? a : b;
        for (int i = 1; i <= x; i++) {
            if (a % i == 0 && b % i == 0) {
                sb.append(i + "_");
                count++;
            }
        }
        String ans = sb.toString();
        System.out.println(ans.split("_")[count-k]);
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int a = in.nextInt();
        int b = in.nextInt();
        int k = in.nextInt();

        int count = 0;
        int x = a < b ? a : b;
        for (int i = 1; i <= x; i++) {
            if (a % i == 0 && b % i == 0) {
                sb.append(i + "_");
                count++;
            }
        }
        String ans = sb.toString();
        System.out.println(ans.split("_")[count-k]);
    } main {
        Scanner in = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int a = in.nextInt();
        int b = in.nextInt();
        int k = in.nextInt();

        int count = 0;
        int x = a < b ? a : b;
        for (int i = 1; i <= x; i++) {
            if (a % i == 0 && b % i == 0) {
                sb.append(i + "_");
                count++;
            }
        }
        String ans = sb.toString();
        System.out.println(ans.split("_")[count-k]);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) StringBuilder sb = new StringBuilder(); sb new StringBuilder() 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 count = 0; count 0 int x = a < b ? a : b; x a < b ? a : b a < b a b a b for (int i = 1; i <= x; i++) {
            if (a % i == 0 && b % i == 0) {
                sb.append(i + "_");
                count++;
            }
        } int i = 1; int i = 1; i 1 i <= x i x i++ i++ i {
            if (a % i == 0 && b % i == 0) {
                sb.append(i + "_");
                count++;
            }
        } {
            if (a % i == 0 && b % i == 0) {
                sb.append(i + "_");
                count++;
            }
        } if (a % i == 0 && b % i == 0) {
                sb.append(i + "_");
                count++;
            } a % i == 0 && b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 {
                sb.append(i + "_");
                count++;
            } sb.append(i + "_") sb.append sb i + "_" i "_" count++ count String ans = sb.toString(); ans sb.toString() sb.toString sb System.out.println(ans.split("_")[count-k]) System.out.println System.out System System.out ans.split("_")[count-k] ans.split("_") ans.split ans "_" count-k count k String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int a = in.nextInt();
        int b = in.nextInt();
        int k = in.nextInt();

        int count = 0;
        int x = a < b ? a : b;
        for (int i = 1; i <= x; i++) {
            if (a % i == 0 && b % i == 0) {
                sb.append(i + "_");
                count++;
            }
        }
        String ans = sb.toString();
        System.out.println(ans.split("_")[count-k]);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int a = in.nextInt();
        int b = in.nextInt();
        int k = in.nextInt();

        int count = 0;
        int x = a < b ? a : b;
        for (int i = 1; i <= x; i++) {
            if (a % i == 0 && b % i == 0) {
                sb.append(i + "_");
                count++;
            }
        }
        String ans = sb.toString();
        System.out.println(ans.split("_")[count-k]);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int a = in.nextInt();
        int b = in.nextInt();
        int k = in.nextInt();

        int count = 0;
        int x = a < b ? a : b;
        for (int i = 1; i <= x; i++) {
            if (a % i == 0 && b % i == 0) {
                sb.append(i + "_");
                count++;
            }
        }
        String ans = sb.toString();
        System.out.println(ans.split("_")[count-k]);
    }
}