import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int gcd = gcd(a,b);
		int cnt = 0;
		int ans = 0;
			for(int i = gcd; i >= 1; i--) {
				if(a%i == 0 && b%i == 0) {
					ans = i;
					cnt ++;
					if(cnt == c) {
						System.out.println(ans);
					}
				}
				
			}
		
		sc.close();
	}
	static int gcd (int a, int b) {
		int temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
}
 import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int gcd = gcd(a,b);
		int cnt = 0;
		int ans = 0;
			for(int i = gcd; i >= 1; i--) {
				if(a%i == 0 && b%i == 0) {
					ans = i;
					cnt ++;
					if(cnt == c) {
						System.out.println(ans);
					}
				}
				
			}
		
		sc.close();
	}
	static int gcd (int a, int b) {
		int temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int gcd = gcd(a,b);
		int cnt = 0;
		int ans = 0;
			for(int i = gcd; i >= 1; i--) {
				if(a%i == 0 && b%i == 0) {
					ans = i;
					cnt ++;
					if(cnt == c) {
						System.out.println(ans);
					}
				}
				
			}
		
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int gcd = gcd(a,b);
		int cnt = 0;
		int ans = 0;
			for(int i = gcd; i >= 1; i--) {
				if(a%i == 0 && b%i == 0) {
					ans = i;
					cnt ++;
					if(cnt == c) {
						System.out.println(ans);
					}
				}
				
			}
		
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int gcd = gcd(a,b); gcd gcd(a,b) gcd a b int cnt = 0; cnt 0 int ans = 0; ans 0 for(int i = gcd; i >= 1; i--) {
				if(a%i == 0 && b%i == 0) {
					ans = i;
					cnt ++;
					if(cnt == c) {
						System.out.println(ans);
					}
				}
				
			} int i = gcd; int i = gcd; i gcd i >= 1 i 1 i-- i-- i {
				if(a%i == 0 && b%i == 0) {
					ans = i;
					cnt ++;
					if(cnt == c) {
						System.out.println(ans);
					}
				}
				
			} {
				if(a%i == 0 && b%i == 0) {
					ans = i;
					cnt ++;
					if(cnt == c) {
						System.out.println(ans);
					}
				}
				
			} if(a%i == 0 && b%i == 0) {
					ans = i;
					cnt ++;
					if(cnt == c) {
						System.out.println(ans);
					}
				} a%i == 0 && b%i == 0 a%i == 0 a%i a i 0 b%i == 0 b%i b i 0 {
					ans = i;
					cnt ++;
					if(cnt == c) {
						System.out.println(ans);
					}
				} ans = i ans i cnt ++ cnt if(cnt == c) {
						System.out.println(ans);
					} cnt == c cnt c {
						System.out.println(ans);
					} System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args static int gcd (int a, int b) {
		int temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	} gcd {
		int temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	} int temp; temp while((temp = a%b)!=0) {
			a = b;
			b = temp;
		} (temp = a%b)!=0 (temp = a%b) temp a%b a b 0 {
			a = b;
			b = temp;
		} a = b a b b = temp b temp return b; b int a a int b b public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int gcd = gcd(a,b);
		int cnt = 0;
		int ans = 0;
			for(int i = gcd; i >= 1; i--) {
				if(a%i == 0 && b%i == 0) {
					ans = i;
					cnt ++;
					if(cnt == c) {
						System.out.println(ans);
					}
				}
				
			}
		
		sc.close();
	}
	static int gcd (int a, int b) {
		int temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int gcd = gcd(a,b);
		int cnt = 0;
		int ans = 0;
			for(int i = gcd; i >= 1; i--) {
				if(a%i == 0 && b%i == 0) {
					ans = i;
					cnt ++;
					if(cnt == c) {
						System.out.println(ans);
					}
				}
				
			}
		
		sc.close();
	}
	static int gcd (int a, int b) {
		int temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int gcd = gcd(a,b);
		int cnt = 0;
		int ans = 0;
			for(int i = gcd; i >= 1; i--) {
				if(a%i == 0 && b%i == 0) {
					ans = i;
					cnt ++;
					if(cnt == c) {
						System.out.println(ans);
					}
				}
				
			}
		
		sc.close();
	}
	static int gcd (int a, int b) {
		int temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
}

