import java.util.Scanner;


public class Main {
	public static void main(String args[]){
		Scanner scanner = new Scanner(System.in);
		//100 50 4 なら1 2 5　10 25 50 の 5
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c;
		int k = scanner.nextInt();
		
		if(a>b) c=a;
		else    c=b;
		for(int i=c;i>=1;i--) {
			if(a%i==0 && b%i==0) {
				--k;
				if(k==0) {
					System.out.println(i);
				}
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]){
		Scanner scanner = new Scanner(System.in);
		//100 50 4 なら1 2 5　10 25 50 の 5
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c;
		int k = scanner.nextInt();
		
		if(a>b) c=a;
		else    c=b;
		for(int i=c;i>=1;i--) {
			if(a%i==0 && b%i==0) {
				--k;
				if(k==0) {
					System.out.println(i);
				}
			}
		}
	}
} Main public static void main(String args[]){
		Scanner scanner = new Scanner(System.in);
		//100 50 4 なら1 2 5　10 25 50 の 5
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c;
		int k = scanner.nextInt();
		
		if(a>b) c=a;
		else    c=b;
		for(int i=c;i>=1;i--) {
			if(a%i==0 && b%i==0) {
				--k;
				if(k==0) {
					System.out.println(i);
				}
			}
		}
	} main {
		Scanner scanner = new Scanner(System.in);
		//100 50 4 なら1 2 5　10 25 50 の 5
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c;
		int k = scanner.nextInt();
		
		if(a>b) c=a;
		else    c=b;
		for(int i=c;i>=1;i--) {
			if(a%i==0 && b%i==0) {
				--k;
				if(k==0) {
					System.out.println(i);
				}
			}
		}
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner int c; c int k = scanner.nextInt(); k scanner.nextInt() scanner.nextInt scanner if(a>b) c=a;
		else    c=b; a>b a b c=a c a c=b c b for(int i=c;i>=1;i--) {
			if(a%i==0 && b%i==0) {
				--k;
				if(k==0) {
					System.out.println(i);
				}
			}
		} int i=c; int i=c; i c i>=1 i 1 i-- i-- i {
			if(a%i==0 && b%i==0) {
				--k;
				if(k==0) {
					System.out.println(i);
				}
			}
		} {
			if(a%i==0 && b%i==0) {
				--k;
				if(k==0) {
					System.out.println(i);
				}
			}
		} if(a%i==0 && b%i==0) {
				--k;
				if(k==0) {
					System.out.println(i);
				}
			} a%i==0 && b%i==0 a%i==0 a%i a i 0 b%i==0 b%i b i 0 {
				--k;
				if(k==0) {
					System.out.println(i);
				}
			} --k k if(k==0) {
					System.out.println(i);
				} k==0 k 0 {
					System.out.println(i);
				} System.out.println(i) System.out.println System.out System System.out i String args[] args public class Main {
	public static void main(String args[]){
		Scanner scanner = new Scanner(System.in);
		//100 50 4 なら1 2 5　10 25 50 の 5
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c;
		int k = scanner.nextInt();
		
		if(a>b) c=a;
		else    c=b;
		for(int i=c;i>=1;i--) {
			if(a%i==0 && b%i==0) {
				--k;
				if(k==0) {
					System.out.println(i);
				}
			}
		}
	}
} public class Main {
	public static void main(String args[]){
		Scanner scanner = new Scanner(System.in);
		//100 50 4 なら1 2 5　10 25 50 の 5
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c;
		int k = scanner.nextInt();
		
		if(a>b) c=a;
		else    c=b;
		for(int i=c;i>=1;i--) {
			if(a%i==0 && b%i==0) {
				--k;
				if(k==0) {
					System.out.println(i);
				}
			}
		}
	}
} Main
import java.util.Scanner;


public class Main {
	public static void main(String args[]){
		Scanner scanner = new Scanner(System.in);
		//100 50 4 なら1 2 5　10 25 50 の 5
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c;
		int k = scanner.nextInt();
		
		if(a>b) c=a;
		else    c=b;
		for(int i=c;i>=1;i--) {
			if(a%i==0 && b%i==0) {
				--k;
				if(k==0) {
					System.out.println(i);
				}
			}
		}
	}
}
