
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
//abc120b
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int a =sc.nextInt();
		int b =sc.nextInt();
		int k=sc.nextInt();
		int smaller =Math.min(a, b);
		Integer[] divisors =new Integer[smaller+1];
		for (int i=0;i<=smaller;i++) {
			divisors[i] =0;
		}
		for (int i=1;i<=smaller;i++) {
			if (a%i==0&&b%i==0) {
				divisors [i] += i;
			}
		}
		Arrays.sort(divisors, Collections.reverseOrder());
		System.out.println(divisors[k-1]);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
	//----------------------------------------
	//置き場
	
	//----------------------------------------
} import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util 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 k=sc.nextInt();
		int smaller =Math.min(a, b);
		Integer[] divisors =new Integer[smaller+1];
		for (int i=0;i<=smaller;i++) {
			divisors[i] =0;
		}
		for (int i=1;i<=smaller;i++) {
			if (a%i==0&&b%i==0) {
				divisors [i] += i;
			}
		}
		Arrays.sort(divisors, Collections.reverseOrder());
		System.out.println(divisors[k-1]);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
	//----------------------------------------
	//置き場
	
	//----------------------------------------
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int a =sc.nextInt();
		int b =sc.nextInt();
		int k=sc.nextInt();
		int smaller =Math.min(a, b);
		Integer[] divisors =new Integer[smaller+1];
		for (int i=0;i<=smaller;i++) {
			divisors[i] =0;
		}
		for (int i=1;i<=smaller;i++) {
			if (a%i==0&&b%i==0) {
				divisors [i] += i;
			}
		}
		Arrays.sort(divisors, Collections.reverseOrder());
		System.out.println(divisors[k-1]);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	} main {
		Scanner sc = new Scanner(System.in);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int a =sc.nextInt();
		int b =sc.nextInt();
		int k=sc.nextInt();
		int smaller =Math.min(a, b);
		Integer[] divisors =new Integer[smaller+1];
		for (int i=0;i<=smaller;i++) {
			divisors[i] =0;
		}
		for (int i=1;i<=smaller;i++) {
			if (a%i==0&&b%i==0) {
				divisors [i] += i;
			}
		}
		Arrays.sort(divisors, Collections.reverseOrder());
		System.out.println(divisors[k-1]);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	} 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 k=sc.nextInt(); k sc.nextInt() sc.nextInt sc int smaller =Math.min(a, b); smaller Math.min(a, b) Math.min Math a b Integer[] divisors =new Integer[smaller+1]; divisors new Integer[smaller+1] smaller+1 smaller 1 for (int i=0;i<=smaller;i++) {
			divisors[i] =0;
		} int i=0; int i=0; i 0 i<=smaller i smaller i++ i++ i {
			divisors[i] =0;
		} {
			divisors[i] =0;
		} divisors[i] =0 divisors[i] divisors i 0 for (int i=1;i<=smaller;i++) {
			if (a%i==0&&b%i==0) {
				divisors [i] += i;
			}
		} int i=1; int i=1; i 1 i<=smaller i smaller i++ i++ i {
			if (a%i==0&&b%i==0) {
				divisors [i] += i;
			}
		} {
			if (a%i==0&&b%i==0) {
				divisors [i] += i;
			}
		} if (a%i==0&&b%i==0) {
				divisors [i] += i;
			} a%i==0&&b%i==0 a%i==0 a%i a i 0 b%i==0 b%i b i 0 {
				divisors [i] += i;
			} divisors [i] += i divisors [i] divisors i i Arrays.sort(divisors, Collections.reverseOrder()) Arrays.sort Arrays divisors Collections.reverseOrder() Collections.reverseOrder Collections System.out.println(divisors[k-1]) System.out.println System.out System System.out divisors[k-1] divisors k-1 k 1 String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int a =sc.nextInt();
		int b =sc.nextInt();
		int k=sc.nextInt();
		int smaller =Math.min(a, b);
		Integer[] divisors =new Integer[smaller+1];
		for (int i=0;i<=smaller;i++) {
			divisors[i] =0;
		}
		for (int i=1;i<=smaller;i++) {
			if (a%i==0&&b%i==0) {
				divisors [i] += i;
			}
		}
		Arrays.sort(divisors, Collections.reverseOrder());
		System.out.println(divisors[k-1]);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
	//----------------------------------------
	//置き場
	
	//----------------------------------------
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int a =sc.nextInt();
		int b =sc.nextInt();
		int k=sc.nextInt();
		int smaller =Math.min(a, b);
		Integer[] divisors =new Integer[smaller+1];
		for (int i=0;i<=smaller;i++) {
			divisors[i] =0;
		}
		for (int i=1;i<=smaller;i++) {
			if (a%i==0&&b%i==0) {
				divisors [i] += i;
			}
		}
		Arrays.sort(divisors, Collections.reverseOrder());
		System.out.println(divisors[k-1]);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
	//----------------------------------------
	//置き場
	
	//----------------------------------------
} Main

import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
//abc120b
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		int a =sc.nextInt();
		int b =sc.nextInt();
		int k=sc.nextInt();
		int smaller =Math.min(a, b);
		Integer[] divisors =new Integer[smaller+1];
		for (int i=0;i<=smaller;i++) {
			divisors[i] =0;
		}
		for (int i=1;i<=smaller;i++) {
			if (a%i==0&&b%i==0) {
				divisors [i] += i;
			}
		}
		Arrays.sort(divisors, Collections.reverseOrder());
		System.out.println(divisors[k-1]);
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
	}
	//----------------------------------------
	//置き場
	
	//----------------------------------------
}