import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(),
            B = sc.nextInt(),
            K = sc.nextInt();
        int n = gcd(A, B),
            count = 0,
            num = 0;
        while(count < K){
            if(n%++num == 0){
                count++;
            }
        }
        System.out.println(n/num);
    }
        public static int gcd(int a, int b){
        if(a > b){
            int c = a;
            a = b;
            b = c;
        }
        int r;
        while((r = b%a) > 0){
            b = a;
            a = r;
        }
        return a;            
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(),
            B = sc.nextInt(),
            K = sc.nextInt();
        int n = gcd(A, B),
            count = 0,
            num = 0;
        while(count < K){
            if(n%++num == 0){
                count++;
            }
        }
        System.out.println(n/num);
    }
        public static int gcd(int a, int b){
        if(a > b){
            int c = a;
            a = b;
            b = c;
        }
        int r;
        while((r = b%a) > 0){
            b = a;
            a = r;
        }
        return a;            
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(),
            B = sc.nextInt(),
            K = sc.nextInt();
        int n = gcd(A, B),
            count = 0,
            num = 0;
        while(count < K){
            if(n%++num == 0){
                count++;
            }
        }
        System.out.println(n/num);
    } main {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(),
            B = sc.nextInt(),
            K = sc.nextInt();
        int n = gcd(A, B),
            count = 0,
            num = 0;
        while(count < K){
            if(n%++num == 0){
                count++;
            }
        }
        System.out.println(n/num);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int A = sc.nextInt() A sc.nextInt() sc.nextInt sc B = sc.nextInt() B sc.nextInt() sc.nextInt sc K = sc.nextInt(); K sc.nextInt() sc.nextInt sc int n = gcd(A, B) n gcd(A, B) gcd A B count = 0 count 0 num = 0; num 0 while(count < K){
            if(n%++num == 0){
                count++;
            }
        } count < K count K {
            if(n%++num == 0){
                count++;
            }
        } if(n%++num == 0){
                count++;
            } n%++num == 0 n%++num n ++num num 0 {
                count++;
            } count++ count System.out.println(n/num) System.out.println System.out System System.out n/num n num String[] args args public static int gcd(int a, int b){
        if(a > b){
            int c = a;
            a = b;
            b = c;
        }
        int r;
        while((r = b%a) > 0){
            b = a;
            a = r;
        }
        return a;            
    } gcd {
        if(a > b){
            int c = a;
            a = b;
            b = c;
        }
        int r;
        while((r = b%a) > 0){
            b = a;
            a = r;
        }
        return a;            
    } if(a > b){
            int c = a;
            a = b;
            b = c;
        } a > b a b {
            int c = a;
            a = b;
            b = c;
        } int c = a; c a a = b a b b = c b c int r; r while((r = b%a) > 0){
            b = a;
            a = r;
        } (r = b%a) > 0 (r = b%a) r b%a b a 0 {
            b = a;
            a = r;
        } b = a b a a = r a r return a; a int a a int b b public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(),
            B = sc.nextInt(),
            K = sc.nextInt();
        int n = gcd(A, B),
            count = 0,
            num = 0;
        while(count < K){
            if(n%++num == 0){
                count++;
            }
        }
        System.out.println(n/num);
    }
        public static int gcd(int a, int b){
        if(a > b){
            int c = a;
            a = b;
            b = c;
        }
        int r;
        while((r = b%a) > 0){
            b = a;
            a = r;
        }
        return a;            
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(),
            B = sc.nextInt(),
            K = sc.nextInt();
        int n = gcd(A, B),
            count = 0,
            num = 0;
        while(count < K){
            if(n%++num == 0){
                count++;
            }
        }
        System.out.println(n/num);
    }
        public static int gcd(int a, int b){
        if(a > b){
            int c = a;
            a = b;
            b = c;
        }
        int r;
        while((r = b%a) > 0){
            b = a;
            a = r;
        }
        return a;            
    }
} Main
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt(),
            B = sc.nextInt(),
            K = sc.nextInt();
        int n = gcd(A, B),
            count = 0,
            num = 0;
        while(count < K){
            if(n%++num == 0){
                count++;
            }
        }
        System.out.println(n/num);
    }
        public static int gcd(int a, int b){
        if(a > b){
            int c = a;
            a = b;
            b = c;
        }
        int r;
        while((r = b%a) > 0){
            b = a;
            a = r;
        }
        return a;            
    }
}