import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int k = scanner.nextInt();
		int tmp = 0;
		int[] ary = new int[k];
		for(int n=100; n>0; n--) {
			if(a%n==0 && b%n==0) {
				ary[tmp]= n;
				tmp++;
			}
			
			if(tmp==k)break;
		}
		System.out.println(ary[k-1]);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int k = scanner.nextInt();
		int tmp = 0;
		int[] ary = new int[k];
		for(int n=100; n>0; n--) {
			if(a%n==0 && b%n==0) {
				ary[tmp]= n;
				tmp++;
			}
			
			if(tmp==k)break;
		}
		System.out.println(ary[k-1]);
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int k = scanner.nextInt();
		int tmp = 0;
		int[] ary = new int[k];
		for(int n=100; n>0; n--) {
			if(a%n==0 && b%n==0) {
				ary[tmp]= n;
				tmp++;
			}
			
			if(tmp==k)break;
		}
		System.out.println(ary[k-1]);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int k = scanner.nextInt();
		int tmp = 0;
		int[] ary = new int[k];
		for(int n=100; n>0; n--) {
			if(a%n==0 && b%n==0) {
				ary[tmp]= n;
				tmp++;
			}
			
			if(tmp==k)break;
		}
		System.out.println(ary[k-1]);
	} 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 k = scanner.nextInt(); k scanner.nextInt() scanner.nextInt scanner int tmp = 0; tmp 0 int[] ary = new int[k]; ary new int[k] k for(int n=100; n>0; n--) {
			if(a%n==0 && b%n==0) {
				ary[tmp]= n;
				tmp++;
			}
			
			if(tmp==k)break;
		} int n=100; int n=100; n 100 n>0 n 0 n-- n-- n {
			if(a%n==0 && b%n==0) {
				ary[tmp]= n;
				tmp++;
			}
			
			if(tmp==k)break;
		} {
			if(a%n==0 && b%n==0) {
				ary[tmp]= n;
				tmp++;
			}
			
			if(tmp==k)break;
		} if(a%n==0 && b%n==0) {
				ary[tmp]= n;
				tmp++;
			} a%n==0 && b%n==0 a%n==0 a%n a n 0 b%n==0 b%n b n 0 {
				ary[tmp]= n;
				tmp++;
			} ary[tmp]= n ary[tmp] ary tmp n tmp++ tmp if(tmp==k)break; tmp==k tmp k break; System.out.println(ary[k-1]) System.out.println System.out System System.out ary[k-1] ary k-1 k 1 String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int k = scanner.nextInt();
		int tmp = 0;
		int[] ary = new int[k];
		for(int n=100; n>0; n--) {
			if(a%n==0 && b%n==0) {
				ary[tmp]= n;
				tmp++;
			}
			
			if(tmp==k)break;
		}
		System.out.println(ary[k-1]);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int k = scanner.nextInt();
		int tmp = 0;
		int[] ary = new int[k];
		for(int n=100; n>0; n--) {
			if(a%n==0 && b%n==0) {
				ary[tmp]= n;
				tmp++;
			}
			
			if(tmp==k)break;
		}
		System.out.println(ary[k-1]);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int k = scanner.nextInt();
		int tmp = 0;
		int[] ary = new int[k];
		for(int n=100; n>0; n--) {
			if(a%n==0 && b%n==0) {
				ary[tmp]= n;
				tmp++;
			}
			
			if(tmp==k)break;
		}
		System.out.println(ary[k-1]);
	}

}