import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Twinkle Twinkle Little Star
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(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, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int k = in.nextInt();
            ArrayList<Integer> array = new ArrayList<>();
            int gcd = 1;
            int index = 0;
            for (int i = 1; i <= a && i <= b; ++i) {
                if (a % i == 0 && b % i == 0) {
                    gcd = i;
                    array.add(gcd);
                    index++;
                    // out.println(gcd);
                }
            }
            Collections.sort(array);
            ArrayList<Integer> crray = new ArrayList<>();
            for (int i = array.size() - 1; i >= 0; i--) {
                int x = array.get(i);
                crray.add(x);
            }
            out.println(crray.get(k - 1));

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}
 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.StringTokenizer; StringTokenizer java.util import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.util.Collections; Collections java.util import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.io.InputStream; InputStream java.io public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(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, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int k = in.nextInt();
            ArrayList<Integer> array = new ArrayList<>();
            int gcd = 1;
            int index = 0;
            for (int i = 1; i <= a && i <= b; ++i) {
                if (a % i == 0 && b % i == 0) {
                    gcd = i;
                    array.add(gcd);
                    index++;
                    // out.println(gcd);
                }
            }
            Collections.sort(array);
            ArrayList<Integer> crray = new ArrayList<>();
            for (int i = array.size() - 1; i >= 0; i--) {
                int x = array.get(i);
                crray.add(x);
            }
            out.println(crray.get(k - 1));

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(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;
        InputReader in = new InputReader(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 InputReader in = new InputReader(inputStream); in new InputReader(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, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int k = in.nextInt();
            ArrayList<Integer> array = new ArrayList<>();
            int gcd = 1;
            int index = 0;
            for (int i = 1; i <= a && i <= b; ++i) {
                if (a % i == 0 && b % i == 0) {
                    gcd = i;
                    array.add(gcd);
                    index++;
                    // out.println(gcd);
                }
            }
            Collections.sort(array);
            ArrayList<Integer> crray = new ArrayList<>();
            for (int i = array.size() - 1; i >= 0; i--) {
                int x = array.get(i);
                crray.add(x);
            }
            out.println(crray.get(k - 1));

        }

    } BKThCommonDivisor public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int k = in.nextInt();
            ArrayList<Integer> array = new ArrayList<>();
            int gcd = 1;
            int index = 0;
            for (int i = 1; i <= a && i <= b; ++i) {
                if (a % i == 0 && b % i == 0) {
                    gcd = i;
                    array.add(gcd);
                    index++;
                    // out.println(gcd);
                }
            }
            Collections.sort(array);
            ArrayList<Integer> crray = new ArrayList<>();
            for (int i = array.size() - 1; i >= 0; i--) {
                int x = array.get(i);
                crray.add(x);
            }
            out.println(crray.get(k - 1));

        } solve {
            int a = in.nextInt();
            int b = in.nextInt();
            int k = in.nextInt();
            ArrayList<Integer> array = new ArrayList<>();
            int gcd = 1;
            int index = 0;
            for (int i = 1; i <= a && i <= b; ++i) {
                if (a % i == 0 && b % i == 0) {
                    gcd = i;
                    array.add(gcd);
                    index++;
                    // out.println(gcd);
                }
            }
            Collections.sort(array);
            ArrayList<Integer> crray = new ArrayList<>();
            for (int i = array.size() - 1; i >= 0; i--) {
                int x = array.get(i);
                crray.add(x);
            }
            out.println(crray.get(k - 1));

        } 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 ArrayList<Integer> array = new ArrayList<>(); array new ArrayList<>() int gcd = 1; gcd 1 int index = 0; index 0 for (int i = 1; i <= a && i <= b; ++i) {
                if (a % i == 0 && b % i == 0) {
                    gcd = i;
                    array.add(gcd);
                    index++;
                    // out.println(gcd);
                }
            } int i = 1; int i = 1; i 1 i <= a && i <= b i <= a i a i <= b i b ++i ++i i {
                if (a % i == 0 && b % i == 0) {
                    gcd = i;
                    array.add(gcd);
                    index++;
                    // out.println(gcd);
                }
            } {
                if (a % i == 0 && b % i == 0) {
                    gcd = i;
                    array.add(gcd);
                    index++;
                    // out.println(gcd);
                }
            } if (a % i == 0 && b % i == 0) {
                    gcd = i;
                    array.add(gcd);
                    index++;
                    // out.println(gcd);
                } a % i == 0 && b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 {
                    gcd = i;
                    array.add(gcd);
                    index++;
                    // out.println(gcd);
                } gcd = i gcd i array.add(gcd) array.add array gcd index++ index Collections.sort(array) Collections.sort Collections array ArrayList<Integer> crray = new ArrayList<>(); crray new ArrayList<>() for (int i = array.size() - 1; i >= 0; i--) {
                int x = array.get(i);
                crray.add(x);
            } int i = array.size() - 1; int i = array.size() - 1; i array.size() - 1 array.size() array.size array 1 i >= 0 i 0 i-- i-- i {
                int x = array.get(i);
                crray.add(x);
            } {
                int x = array.get(i);
                crray.add(x);
            } int x = array.get(i); x array.get(i) array.get array i crray.add(x) crray.add crray x out.println(crray.get(k - 1)) out.println out crray.get(k - 1) crray.get crray k - 1 k 1 int testNumber testNumber InputReader in in PrintWriter out out static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    } InputReader public BufferedReader reader; reader public StringTokenizer tokenizer; tokenizer public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        } InputReader {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        } reader = new BufferedReader(new InputStreamReader(stream), 32768) reader new BufferedReader(new InputStreamReader(stream), 32768) tokenizer = null tokenizer null InputStream stream stream public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } next {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        } while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } tokenizer == null || !tokenizer.hasMoreTokens() tokenizer == null tokenizer null !tokenizer.hasMoreTokens() tokenizer.hasMoreTokens() tokenizer.hasMoreTokens tokenizer {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            } try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } IOException e {
                    throw new RuntimeException(e);
                } throw new RuntimeException(e); new RuntimeException(e) {
                    tokenizer = new StringTokenizer(reader.readLine());
                } tokenizer = new StringTokenizer(reader.readLine()) tokenizer new StringTokenizer(reader.readLine()) return tokenizer.nextToken(); tokenizer.nextToken() tokenizer.nextToken tokenizer public int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(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, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int k = in.nextInt();
            ArrayList<Integer> array = new ArrayList<>();
            int gcd = 1;
            int index = 0;
            for (int i = 1; i <= a && i <= b; ++i) {
                if (a % i == 0 && b % i == 0) {
                    gcd = i;
                    array.add(gcd);
                    index++;
                    // out.println(gcd);
                }
            }
            Collections.sort(array);
            ArrayList<Integer> crray = new ArrayList<>();
            for (int i = array.size() - 1; i >= 0; i--) {
                int x = array.get(i);
                crray.add(x);
            }
            out.println(crray.get(k - 1));

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(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, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int k = in.nextInt();
            ArrayList<Integer> array = new ArrayList<>();
            int gcd = 1;
            int index = 0;
            for (int i = 1; i <= a && i <= b; ++i) {
                if (a % i == 0 && b % i == 0) {
                    gcd = i;
                    array.add(gcd);
                    index++;
                    // out.println(gcd);
                }
            }
            Collections.sort(array);
            ArrayList<Integer> crray = new ArrayList<>();
            for (int i = array.size() - 1; i >= 0; i--) {
                int x = array.get(i);
                crray.add(x);
            }
            out.println(crray.get(k - 1));

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Twinkle Twinkle Little Star
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(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, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int k = in.nextInt();
            ArrayList<Integer> array = new ArrayList<>();
            int gcd = 1;
            int index = 0;
            for (int i = 1; i <= a && i <= b; ++i) {
                if (a % i == 0 && b % i == 0) {
                    gcd = i;
                    array.add(gcd);
                    index++;
                    // out.println(gcd);
                }
            }
            Collections.sort(array);
            ArrayList<Integer> crray = new ArrayList<>();
            for (int i = array.size() - 1; i >= 0; i--) {
                int x = array.get(i);
                crray.add(x);
            }
            out.println(crray.get(k - 1));

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

