import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int K = scan.nextInt();

		int cnt = 0;
		for (int i = 1; i <= 100; i++) {
			if (A % (101-i) == 0 && B % (101-i) == 0) {
				cnt++;
				if (cnt == K) {
					System.out.println(101-i);
					return;
				}
			}
		}

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int K = scan.nextInt();

		int cnt = 0;
		for (int i = 1; i <= 100; i++) {
			if (A % (101-i) == 0 && B % (101-i) == 0) {
				cnt++;
				if (cnt == K) {
					System.out.println(101-i);
					return;
				}
			}
		}

	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int K = scan.nextInt();

		int cnt = 0;
		for (int i = 1; i <= 100; i++) {
			if (A % (101-i) == 0 && B % (101-i) == 0) {
				cnt++;
				if (cnt == K) {
					System.out.println(101-i);
					return;
				}
			}
		}

	} main {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int K = scan.nextInt();

		int cnt = 0;
		for (int i = 1; i <= 100; i++) {
			if (A % (101-i) == 0 && B % (101-i) == 0) {
				cnt++;
				if (cnt == K) {
					System.out.println(101-i);
					return;
				}
			}
		}

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int A = scan.nextInt(); A scan.nextInt() scan.nextInt scan int B = scan.nextInt(); B scan.nextInt() scan.nextInt scan int K = scan.nextInt(); K scan.nextInt() scan.nextInt scan int cnt = 0; cnt 0 for (int i = 1; i <= 100; i++) {
			if (A % (101-i) == 0 && B % (101-i) == 0) {
				cnt++;
				if (cnt == K) {
					System.out.println(101-i);
					return;
				}
			}
		} int i = 1; int i = 1; i 1 i <= 100 i 100 i++ i++ i {
			if (A % (101-i) == 0 && B % (101-i) == 0) {
				cnt++;
				if (cnt == K) {
					System.out.println(101-i);
					return;
				}
			}
		} {
			if (A % (101-i) == 0 && B % (101-i) == 0) {
				cnt++;
				if (cnt == K) {
					System.out.println(101-i);
					return;
				}
			}
		} if (A % (101-i) == 0 && B % (101-i) == 0) {
				cnt++;
				if (cnt == K) {
					System.out.println(101-i);
					return;
				}
			} A % (101-i) == 0 && B % (101-i) == 0 A % (101-i) == 0 A % (101-i) A (101-i) 101 i 0 B % (101-i) == 0 B % (101-i) B (101-i) 101 i 0 {
				cnt++;
				if (cnt == K) {
					System.out.println(101-i);
					return;
				}
			} cnt++ cnt if (cnt == K) {
					System.out.println(101-i);
					return;
				} cnt == K cnt K {
					System.out.println(101-i);
					return;
				} System.out.println(101-i) System.out.println System.out System System.out 101-i 101 i return; String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int K = scan.nextInt();

		int cnt = 0;
		for (int i = 1; i <= 100; i++) {
			if (A % (101-i) == 0 && B % (101-i) == 0) {
				cnt++;
				if (cnt == K) {
					System.out.println(101-i);
					return;
				}
			}
		}

	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int K = scan.nextInt();

		int cnt = 0;
		for (int i = 1; i <= 100; i++) {
			if (A % (101-i) == 0 && B % (101-i) == 0) {
				cnt++;
				if (cnt == K) {
					System.out.println(101-i);
					return;
				}
			}
		}

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int K = scan.nextInt();

		int cnt = 0;
		for (int i = 1; i <= 100; i++) {
			if (A % (101-i) == 0 && B % (101-i) == 0) {
				cnt++;
				if (cnt == K) {
					System.out.println(101-i);
					return;
				}
			}
		}

	}
}
