import java.util.*;

public class Main{
        public static void main(String[] args){
                Scanner scan = new Scanner(System.in);
                int cntA = scan.nextInt();
                int cntB = scan.nextInt();
                int cntK = scan.nextInt();
                int tmp = 0;
                int count =0;

                if(cntA<cntB){
                        tmp = cntA;
                }else{
                        tmp = cntB;
                }

                for(int i=tmp ; i>=1 ; i--){
                        if(cntA%i==0 && cntB%i==0){
                                count += 1;
                                if(count==cntK){
                                        System.out.println(i);
                                }
                        }
                }
        }
} import java.util.*; util.* java public class Main{
        public static void main(String[] args){
                Scanner scan = new Scanner(System.in);
                int cntA = scan.nextInt();
                int cntB = scan.nextInt();
                int cntK = scan.nextInt();
                int tmp = 0;
                int count =0;

                if(cntA<cntB){
                        tmp = cntA;
                }else{
                        tmp = cntB;
                }

                for(int i=tmp ; i>=1 ; i--){
                        if(cntA%i==0 && cntB%i==0){
                                count += 1;
                                if(count==cntK){
                                        System.out.println(i);
                                }
                        }
                }
        }
} Main public static void main(String[] args){
                Scanner scan = new Scanner(System.in);
                int cntA = scan.nextInt();
                int cntB = scan.nextInt();
                int cntK = scan.nextInt();
                int tmp = 0;
                int count =0;

                if(cntA<cntB){
                        tmp = cntA;
                }else{
                        tmp = cntB;
                }

                for(int i=tmp ; i>=1 ; i--){
                        if(cntA%i==0 && cntB%i==0){
                                count += 1;
                                if(count==cntK){
                                        System.out.println(i);
                                }
                        }
                }
        } main {
                Scanner scan = new Scanner(System.in);
                int cntA = scan.nextInt();
                int cntB = scan.nextInt();
                int cntK = scan.nextInt();
                int tmp = 0;
                int count =0;

                if(cntA<cntB){
                        tmp = cntA;
                }else{
                        tmp = cntB;
                }

                for(int i=tmp ; i>=1 ; i--){
                        if(cntA%i==0 && cntB%i==0){
                                count += 1;
                                if(count==cntK){
                                        System.out.println(i);
                                }
                        }
                }
        } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int cntA = scan.nextInt(); cntA scan.nextInt() scan.nextInt scan int cntB = scan.nextInt(); cntB scan.nextInt() scan.nextInt scan int cntK = scan.nextInt(); cntK scan.nextInt() scan.nextInt scan int tmp = 0; tmp 0 int count =0; count 0 if(cntA<cntB){
                        tmp = cntA;
                }else{
                        tmp = cntB;
                } cntA<cntB cntA cntB {
                        tmp = cntA;
                } tmp = cntA tmp cntA {
                        tmp = cntB;
                } tmp = cntB tmp cntB for(int i=tmp ; i>=1 ; i--){
                        if(cntA%i==0 && cntB%i==0){
                                count += 1;
                                if(count==cntK){
                                        System.out.println(i);
                                }
                        }
                } int i=tmp ; int i=tmp ; i tmp i>=1 i 1 i-- i-- i {
                        if(cntA%i==0 && cntB%i==0){
                                count += 1;
                                if(count==cntK){
                                        System.out.println(i);
                                }
                        }
                } {
                        if(cntA%i==0 && cntB%i==0){
                                count += 1;
                                if(count==cntK){
                                        System.out.println(i);
                                }
                        }
                } if(cntA%i==0 && cntB%i==0){
                                count += 1;
                                if(count==cntK){
                                        System.out.println(i);
                                }
                        } cntA%i==0 && cntB%i==0 cntA%i==0 cntA%i cntA i 0 cntB%i==0 cntB%i cntB i 0 {
                                count += 1;
                                if(count==cntK){
                                        System.out.println(i);
                                }
                        } count += 1 count 1 if(count==cntK){
                                        System.out.println(i);
                                } count==cntK count cntK {
                                        System.out.println(i);
                                } System.out.println(i) System.out.println System.out System System.out i String[] args args public class Main{
        public static void main(String[] args){
                Scanner scan = new Scanner(System.in);
                int cntA = scan.nextInt();
                int cntB = scan.nextInt();
                int cntK = scan.nextInt();
                int tmp = 0;
                int count =0;

                if(cntA<cntB){
                        tmp = cntA;
                }else{
                        tmp = cntB;
                }

                for(int i=tmp ; i>=1 ; i--){
                        if(cntA%i==0 && cntB%i==0){
                                count += 1;
                                if(count==cntK){
                                        System.out.println(i);
                                }
                        }
                }
        }
} public class Main{
        public static void main(String[] args){
                Scanner scan = new Scanner(System.in);
                int cntA = scan.nextInt();
                int cntB = scan.nextInt();
                int cntK = scan.nextInt();
                int tmp = 0;
                int count =0;

                if(cntA<cntB){
                        tmp = cntA;
                }else{
                        tmp = cntB;
                }

                for(int i=tmp ; i>=1 ; i--){
                        if(cntA%i==0 && cntB%i==0){
                                count += 1;
                                if(count==cntK){
                                        System.out.println(i);
                                }
                        }
                }
        }
} Main
import java.util.*;

public class Main{
        public static void main(String[] args){
                Scanner scan = new Scanner(System.in);
                int cntA = scan.nextInt();
                int cntB = scan.nextInt();
                int cntK = scan.nextInt();
                int tmp = 0;
                int count =0;

                if(cntA<cntB){
                        tmp = cntA;
                }else{
                        tmp = cntB;
                }

                for(int i=tmp ; i>=1 ; i--){
                        if(cntA%i==0 && cntB%i==0){
                                count += 1;
                                if(count==cntK){
                                        System.out.println(i);
                                }
                        }
                }
        }
}