import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int X = sc.nextInt();
    	int Y = sc.nextInt();
    	int Z = sc.nextInt();
    	sc.close();
    	int[] ary = new int[Z];
    	int min = X <= Y ? X : Y;
    	for(int i = min; i > 0; i--){
    		if(X % i == 0 && Y % i == 0){
    			ary[Z-1] = i;
    			Z--;
    		}
    		if(Z <= 0) break;
    	}
    	System.out.println(ary[0]);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int X = sc.nextInt();
    	int Y = sc.nextInt();
    	int Z = sc.nextInt();
    	sc.close();
    	int[] ary = new int[Z];
    	int min = X <= Y ? X : Y;
    	for(int i = min; i > 0; i--){
    		if(X % i == 0 && Y % i == 0){
    			ary[Z-1] = i;
    			Z--;
    		}
    		if(Z <= 0) break;
    	}
    	System.out.println(ary[0]);
    }
} Main public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int X = sc.nextInt();
    	int Y = sc.nextInt();
    	int Z = sc.nextInt();
    	sc.close();
    	int[] ary = new int[Z];
    	int min = X <= Y ? X : Y;
    	for(int i = min; i > 0; i--){
    		if(X % i == 0 && Y % i == 0){
    			ary[Z-1] = i;
    			Z--;
    		}
    		if(Z <= 0) break;
    	}
    	System.out.println(ary[0]);
    } main {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int X = sc.nextInt();
    	int Y = sc.nextInt();
    	int Z = sc.nextInt();
    	sc.close();
    	int[] ary = new int[Z];
    	int min = X <= Y ? X : Y;
    	for(int i = min; i > 0; i--){
    		if(X % i == 0 && Y % i == 0){
    			ary[Z-1] = i;
    			Z--;
    		}
    		if(Z <= 0) break;
    	}
    	System.out.println(ary[0]);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc int Y = sc.nextInt(); Y sc.nextInt() sc.nextInt sc int Z = sc.nextInt(); Z sc.nextInt() sc.nextInt sc sc.close() sc.close sc int[] ary = new int[Z]; ary new int[Z] Z int min = X <= Y ? X : Y; min X <= Y ? X : Y X <= Y X Y X Y for(int i = min; i > 0; i--){
    		if(X % i == 0 && Y % i == 0){
    			ary[Z-1] = i;
    			Z--;
    		}
    		if(Z <= 0) break;
    	} int i = min; int i = min; i min i > 0 i 0 i-- i-- i {
    		if(X % i == 0 && Y % i == 0){
    			ary[Z-1] = i;
    			Z--;
    		}
    		if(Z <= 0) break;
    	} {
    		if(X % i == 0 && Y % i == 0){
    			ary[Z-1] = i;
    			Z--;
    		}
    		if(Z <= 0) break;
    	} if(X % i == 0 && Y % i == 0){
    			ary[Z-1] = i;
    			Z--;
    		} X % i == 0 && Y % i == 0 X % i == 0 X % i X i 0 Y % i == 0 Y % i Y i 0 {
    			ary[Z-1] = i;
    			Z--;
    		} ary[Z-1] = i ary[Z-1] ary Z-1 Z 1 i Z-- Z if(Z <= 0) break; Z <= 0 Z 0 break; System.out.println(ary[0]) System.out.println System.out System System.out ary[0] ary 0 String[] args args public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int X = sc.nextInt();
    	int Y = sc.nextInt();
    	int Z = sc.nextInt();
    	sc.close();
    	int[] ary = new int[Z];
    	int min = X <= Y ? X : Y;
    	for(int i = min; i > 0; i--){
    		if(X % i == 0 && Y % i == 0){
    			ary[Z-1] = i;
    			Z--;
    		}
    		if(Z <= 0) break;
    	}
    	System.out.println(ary[0]);
    }
} public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int X = sc.nextInt();
    	int Y = sc.nextInt();
    	int Z = sc.nextInt();
    	sc.close();
    	int[] ary = new int[Z];
    	int min = X <= Y ? X : Y;
    	for(int i = min; i > 0; i--){
    		if(X % i == 0 && Y % i == 0){
    			ary[Z-1] = i;
    			Z--;
    		}
    		if(Z <= 0) break;
    	}
    	System.out.println(ary[0]);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int X = sc.nextInt();
    	int Y = sc.nextInt();
    	int Z = sc.nextInt();
    	sc.close();
    	int[] ary = new int[Z];
    	int min = X <= Y ? X : Y;
    	for(int i = min; i > 0; i--){
    		if(X % i == 0 && Y % i == 0){
    			ary[Z-1] = i;
    			Z--;
    		}
    		if(Z <= 0) break;
    	}
    	System.out.println(ary[0]);
    }
}