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;
		int ans = 1;
		
		for (int i = 100; i > 0; i--) {
			if (cnt < K) {
				if (A % i == 0 && B % i == 0) {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				}else {
					//System.out.println("no");
				}
			}else {
				break;
			}
		}
		System.out.println(ans);
	}
} 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;
		int ans = 1;
		
		for (int i = 100; i > 0; i--) {
			if (cnt < K) {
				if (A % i == 0 && B % i == 0) {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				}else {
					//System.out.println("no");
				}
			}else {
				break;
			}
		}
		System.out.println(ans);
	}
} 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;
		int ans = 1;
		
		for (int i = 100; i > 0; i--) {
			if (cnt < K) {
				if (A % i == 0 && B % i == 0) {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				}else {
					//System.out.println("no");
				}
			}else {
				break;
			}
		}
		System.out.println(ans);
	} main {
		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();
		int K = scan.nextInt();
		int cnt = 0;
		int ans = 1;
		
		for (int i = 100; i > 0; i--) {
			if (cnt < K) {
				if (A % i == 0 && B % i == 0) {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				}else {
					//System.out.println("no");
				}
			}else {
				break;
			}
		}
		System.out.println(ans);
	} 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 int ans = 1; ans 1 for (int i = 100; i > 0; i--) {
			if (cnt < K) {
				if (A % i == 0 && B % i == 0) {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				}else {
					//System.out.println("no");
				}
			}else {
				break;
			}
		} int i = 100; int i = 100; i 100 i > 0 i 0 i-- i-- i {
			if (cnt < K) {
				if (A % i == 0 && B % i == 0) {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				}else {
					//System.out.println("no");
				}
			}else {
				break;
			}
		} {
			if (cnt < K) {
				if (A % i == 0 && B % i == 0) {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				}else {
					//System.out.println("no");
				}
			}else {
				break;
			}
		} if (cnt < K) {
				if (A % i == 0 && B % i == 0) {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				}else {
					//System.out.println("no");
				}
			}else {
				break;
			} cnt < K cnt K {
				if (A % i == 0 && B % i == 0) {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				}else {
					//System.out.println("no");
				}
			} if (A % i == 0 && B % i == 0) {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				}else {
					//System.out.println("no");
				} A % i == 0 && B % i == 0 A % i == 0 A % i A i 0 B % i == 0 B % i B i 0 {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				} cnt += 1 cnt 1 ans = i ans i {
					//System.out.println("no");
				} {
				break;
			} break; System.out.println(ans) System.out.println System.out System System.out ans 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;
		int ans = 1;
		
		for (int i = 100; i > 0; i--) {
			if (cnt < K) {
				if (A % i == 0 && B % i == 0) {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				}else {
					//System.out.println("no");
				}
			}else {
				break;
			}
		}
		System.out.println(ans);
	}
} 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;
		int ans = 1;
		
		for (int i = 100; i > 0; i--) {
			if (cnt < K) {
				if (A % i == 0 && B % i == 0) {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				}else {
					//System.out.println("no");
				}
			}else {
				break;
			}
		}
		System.out.println(ans);
	}
} 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;
		int ans = 1;
		
		for (int i = 100; i > 0; i--) {
			if (cnt < K) {
				if (A % i == 0 && B % i == 0) {
					cnt += 1;
					ans = i;
					//System.out.println("cnt" + cnt);
					//System.out.println("ans" + ans);
				}else {
					//System.out.println("no");
				}
			}else {
				break;
			}
		}
		System.out.println(ans);
	}
}