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();

		sc.close();

		int[] yaku = new int[15];
		int l = 1 ;

		for(int i = 100 ; i > 0 ; i--){
			if(A % i == 0 && B % i == 0){
				yaku[l] = i;
				l += 1;
			}
		}

		/*
		for(int j = 0 ; j < 15 ; j++){
			System.out.println(yaku[j]);
		}
*/
		System.out.println(yaku[K]);

	}

} 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();

		sc.close();

		int[] yaku = new int[15];
		int l = 1 ;

		for(int i = 100 ; i > 0 ; i--){
			if(A % i == 0 && B % i == 0){
				yaku[l] = i;
				l += 1;
			}
		}

		/*
		for(int j = 0 ; j < 15 ; j++){
			System.out.println(yaku[j]);
		}
*/
		System.out.println(yaku[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();

		sc.close();

		int[] yaku = new int[15];
		int l = 1 ;

		for(int i = 100 ; i > 0 ; i--){
			if(A % i == 0 && B % i == 0){
				yaku[l] = i;
				l += 1;
			}
		}

		/*
		for(int j = 0 ; j < 15 ; j++){
			System.out.println(yaku[j]);
		}
*/
		System.out.println(yaku[K]);

	} main {

		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		int K = sc.nextInt();

		sc.close();

		int[] yaku = new int[15];
		int l = 1 ;

		for(int i = 100 ; i > 0 ; i--){
			if(A % i == 0 && B % i == 0){
				yaku[l] = i;
				l += 1;
			}
		}

		/*
		for(int j = 0 ; j < 15 ; j++){
			System.out.println(yaku[j]);
		}
*/
		System.out.println(yaku[K]);

	} 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 sc.close() sc.close sc int[] yaku = new int[15]; yaku new int[15] 15 int l = 1 ; l 1 for(int i = 100 ; i > 0 ; i--){
			if(A % i == 0 && B % i == 0){
				yaku[l] = i;
				l += 1;
			}
		} int i = 100 ; int i = 100 ; i 100 i > 0 i 0 i-- i-- i {
			if(A % i == 0 && B % i == 0){
				yaku[l] = i;
				l += 1;
			}
		} {
			if(A % i == 0 && B % i == 0){
				yaku[l] = i;
				l += 1;
			}
		} if(A % i == 0 && B % i == 0){
				yaku[l] = i;
				l += 1;
			} A % i == 0 && B % i == 0 A % i == 0 A % i A i 0 B % i == 0 B % i B i 0 {
				yaku[l] = i;
				l += 1;
			} yaku[l] = i yaku[l] yaku l i l += 1 l 1 System.out.println(yaku[K]) System.out.println System.out System System.out yaku[K] yaku K 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();

		sc.close();

		int[] yaku = new int[15];
		int l = 1 ;

		for(int i = 100 ; i > 0 ; i--){
			if(A % i == 0 && B % i == 0){
				yaku[l] = i;
				l += 1;
			}
		}

		/*
		for(int j = 0 ; j < 15 ; j++){
			System.out.println(yaku[j]);
		}
*/
		System.out.println(yaku[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();

		sc.close();

		int[] yaku = new int[15];
		int l = 1 ;

		for(int i = 100 ; i > 0 ; i--){
			if(A % i == 0 && B % i == 0){
				yaku[l] = i;
				l += 1;
			}
		}

		/*
		for(int j = 0 ; j < 15 ; j++){
			System.out.println(yaku[j]);
		}
*/
		System.out.println(yaku[K]);

	}

} 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 K = sc.nextInt();

		sc.close();

		int[] yaku = new int[15];
		int l = 1 ;

		for(int i = 100 ; i > 0 ; i--){
			if(A % i == 0 && B % i == 0){
				yaku[l] = i;
				l += 1;
			}
		}

		/*
		for(int j = 0 ; j < 15 ; j++){
			System.out.println(yaku[j]);
		}
*/
		System.out.println(yaku[K]);

	}

}