import java.util.ArrayList;
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 k = sc.nextInt();
		int ans = getKth(getGcd(a, b), k);
		System.out.println(ans);
	}
	
	static int getGcd(int a, int b) {
		if (a == 0) {
			return b;
		}
		return getGcd(b % a, a);
	}
	static int getKth(int n, int k) {
		ArrayList<Integer> divisors = new ArrayList<>();
		for(int i = 1; i <= n / 2; i++){
			if(n % i == 0){
				divisors.add(i);
			}
		}
		divisors.add(n);
		return(divisors.get(divisors.size() - k));
	}
} import java.util.ArrayList; ArrayList 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 ans = getKth(getGcd(a, b), k);
		System.out.println(ans);
	}
	
	static int getGcd(int a, int b) {
		if (a == 0) {
			return b;
		}
		return getGcd(b % a, a);
	}
	static int getKth(int n, int k) {
		ArrayList<Integer> divisors = new ArrayList<>();
		for(int i = 1; i <= n / 2; i++){
			if(n % i == 0){
				divisors.add(i);
			}
		}
		divisors.add(n);
		return(divisors.get(divisors.size() - k));
	}
} 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 ans = getKth(getGcd(a, b), k);
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		int ans = getKth(getGcd(a, b), k);
		System.out.println(ans);
	} 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 ans = getKth(getGcd(a, b), k); ans getKth(getGcd(a, b), k) getKth getGcd(a, b) getGcd a b k System.out.println(ans) System.out.println System.out System System.out ans String[] args args static int getGcd(int a, int b) {
		if (a == 0) {
			return b;
		}
		return getGcd(b % a, a);
	} getGcd {
		if (a == 0) {
			return b;
		}
		return getGcd(b % a, a);
	} if (a == 0) {
			return b;
		} a == 0 a 0 {
			return b;
		} return b; b return getGcd(b % a, a); getGcd(b % a, a) getGcd b % a b a a int a a int b b static int getKth(int n, int k) {
		ArrayList<Integer> divisors = new ArrayList<>();
		for(int i = 1; i <= n / 2; i++){
			if(n % i == 0){
				divisors.add(i);
			}
		}
		divisors.add(n);
		return(divisors.get(divisors.size() - k));
	} getKth {
		ArrayList<Integer> divisors = new ArrayList<>();
		for(int i = 1; i <= n / 2; i++){
			if(n % i == 0){
				divisors.add(i);
			}
		}
		divisors.add(n);
		return(divisors.get(divisors.size() - k));
	} ArrayList<Integer> divisors = new ArrayList<>(); divisors new ArrayList<>() for(int i = 1; i <= n / 2; i++){
			if(n % i == 0){
				divisors.add(i);
			}
		} int i = 1; int i = 1; i 1 i <= n / 2 i n / 2 n 2 i++ i++ i {
			if(n % i == 0){
				divisors.add(i);
			}
		} {
			if(n % i == 0){
				divisors.add(i);
			}
		} if(n % i == 0){
				divisors.add(i);
			} n % i == 0 n % i n i 0 {
				divisors.add(i);
			} divisors.add(i) divisors.add divisors i divisors.add(n) divisors.add divisors n return(divisors.get(divisors.size() - k)); (divisors.get(divisors.size() - k)) divisors.get divisors divisors.size() - k divisors.size() divisors.size divisors k int n n int k k 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 ans = getKth(getGcd(a, b), k);
		System.out.println(ans);
	}
	
	static int getGcd(int a, int b) {
		if (a == 0) {
			return b;
		}
		return getGcd(b % a, a);
	}
	static int getKth(int n, int k) {
		ArrayList<Integer> divisors = new ArrayList<>();
		for(int i = 1; i <= n / 2; i++){
			if(n % i == 0){
				divisors.add(i);
			}
		}
		divisors.add(n);
		return(divisors.get(divisors.size() - k));
	}
} 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 ans = getKth(getGcd(a, b), k);
		System.out.println(ans);
	}
	
	static int getGcd(int a, int b) {
		if (a == 0) {
			return b;
		}
		return getGcd(b % a, a);
	}
	static int getKth(int n, int k) {
		ArrayList<Integer> divisors = new ArrayList<>();
		for(int i = 1; i <= n / 2; i++){
			if(n % i == 0){
				divisors.add(i);
			}
		}
		divisors.add(n);
		return(divisors.get(divisors.size() - k));
	}
} Main
import java.util.ArrayList;
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 k = sc.nextInt();
		int ans = getKth(getGcd(a, b), k);
		System.out.println(ans);
	}
	
	static int getGcd(int a, int b) {
		if (a == 0) {
			return b;
		}
		return getGcd(b % a, a);
	}
	static int getKth(int n, int k) {
		ArrayList<Integer> divisors = new ArrayList<>();
		for(int i = 1; i <= n / 2; i++){
			if(n % i == 0){
				divisors.add(i);
			}
		}
		divisors.add(n);
		return(divisors.get(divisors.size() - k));
	}
}