import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Eric
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BKThCommonDivisor solver = new BKThCommonDivisor();
        solver.solve(1, in, out);
        out.close();
    }

    static class BKThCommonDivisor {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int res = solve(A, B, K);
            out.println(res);
        }

        private int solve(int a, int b, int K) {
            int cur = 0;
            for (int i = 101; i >= 1; i--) {
                if (a % i == 0 && b % i == 0) {
                    cur++;
                    if (cur == K)
                        return i;
                }
            }
            throw new RuntimeException("Impossible");
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BKThCommonDivisor solver = new BKThCommonDivisor();
        solver.solve(1, in, out);
        out.close();
    }

    static class BKThCommonDivisor {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int res = solve(A, B, K);
            out.println(res);
        }

        private int solve(int a, int b, int K) {
            int cur = 0;
            for (int i = 101; i >= 1; i--) {
                if (a % i == 0 && b % i == 0) {
                    cur++;
                    if (cur == K)
                        return i;
                }
            }
            throw new RuntimeException("Impossible");
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BKThCommonDivisor solver = new BKThCommonDivisor();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BKThCommonDivisor solver = new BKThCommonDivisor();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) BKThCommonDivisor solver = new BKThCommonDivisor(); solver new BKThCommonDivisor() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class BKThCommonDivisor {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int res = solve(A, B, K);
            out.println(res);
        }

        private int solve(int a, int b, int K) {
            int cur = 0;
            for (int i = 101; i >= 1; i--) {
                if (a % i == 0 && b % i == 0) {
                    cur++;
                    if (cur == K)
                        return i;
                }
            }
            throw new RuntimeException("Impossible");
        }

    } BKThCommonDivisor public void solve(int testNumber, Scanner in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int res = solve(A, B, K);
            out.println(res);
        } solve {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int res = solve(A, B, K);
            out.println(res);
        } 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 res = solve(A, B, K); res solve(A, B, K) solve A B K out.println(res) out.println out res int testNumber testNumber Scanner in in PrintWriter out out private int solve(int a, int b, int K) {
            int cur = 0;
            for (int i = 101; i >= 1; i--) {
                if (a % i == 0 && b % i == 0) {
                    cur++;
                    if (cur == K)
                        return i;
                }
            }
            throw new RuntimeException("Impossible");
        } solve {
            int cur = 0;
            for (int i = 101; i >= 1; i--) {
                if (a % i == 0 && b % i == 0) {
                    cur++;
                    if (cur == K)
                        return i;
                }
            }
            throw new RuntimeException("Impossible");
        } int cur = 0; cur 0 for (int i = 101; i >= 1; i--) {
                if (a % i == 0 && b % i == 0) {
                    cur++;
                    if (cur == K)
                        return i;
                }
            } int i = 101; int i = 101; i 101 i >= 1 i 1 i-- i-- i {
                if (a % i == 0 && b % i == 0) {
                    cur++;
                    if (cur == K)
                        return i;
                }
            } {
                if (a % i == 0 && b % i == 0) {
                    cur++;
                    if (cur == K)
                        return i;
                }
            } if (a % i == 0 && b % i == 0) {
                    cur++;
                    if (cur == K)
                        return i;
                } a % i == 0 && b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 {
                    cur++;
                    if (cur == K)
                        return i;
                } cur++ cur if (cur == K)
                        return i; cur == K cur K return i; i throw new RuntimeException("Impossible"); new RuntimeException("Impossible") int a a int b b int K K public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BKThCommonDivisor solver = new BKThCommonDivisor();
        solver.solve(1, in, out);
        out.close();
    }

    static class BKThCommonDivisor {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int res = solve(A, B, K);
            out.println(res);
        }

        private int solve(int a, int b, int K) {
            int cur = 0;
            for (int i = 101; i >= 1; i--) {
                if (a % i == 0 && b % i == 0) {
                    cur++;
                    if (cur == K)
                        return i;
                }
            }
            throw new RuntimeException("Impossible");
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BKThCommonDivisor solver = new BKThCommonDivisor();
        solver.solve(1, in, out);
        out.close();
    }

    static class BKThCommonDivisor {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int res = solve(A, B, K);
            out.println(res);
        }

        private int solve(int a, int b, int K) {
            int cur = 0;
            for (int i = 101; i >= 1; i--) {
                if (a % i == 0 && b % i == 0) {
                    cur++;
                    if (cur == K)
                        return i;
                }
            }
            throw new RuntimeException("Impossible");
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Eric
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BKThCommonDivisor solver = new BKThCommonDivisor();
        solver.solve(1, in, out);
        out.close();
    }

    static class BKThCommonDivisor {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            int K = in.nextInt();
            int res = solve(A, B, K);
            out.println(res);
        }

        private int solve(int a, int b, int K) {
            int cur = 0;
            for (int i = 101; i >= 1; i--) {
                if (a % i == 0 && b % i == 0) {
                    cur++;
                    if (cur == K)
                        return i;
                }
            }
            throw new RuntimeException("Impossible");
        }

    }
}

