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 c;
      
      if(b > a){
        c = a;
       	a = b;
       	b = c;
      }
      
      int count = 0;
      
      for(int i = 1; i <= b; i++){
        if(a % i == 0 && b % i == 0)
        count++;
      }
      
      
      
      int[]d = new int[count];
      int i;
      
      for(i = 0; i < count; i++){
        if(i == 0){
          d[i] = 1;
        } else {
          for(int l = d[i-1]+1; l <= b; l++){
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          }
        }
      }
      
     
     System.out.println(d[count - 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();
      
      int c;
      
      if(b > a){
        c = a;
       	a = b;
       	b = c;
      }
      
      int count = 0;
      
      for(int i = 1; i <= b; i++){
        if(a % i == 0 && b % i == 0)
        count++;
      }
      
      
      
      int[]d = new int[count];
      int i;
      
      for(i = 0; i < count; i++){
        if(i == 0){
          d[i] = 1;
        } else {
          for(int l = d[i-1]+1; l <= b; l++){
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          }
        }
      }
      
     
     System.out.println(d[count - 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 c;
      
      if(b > a){
        c = a;
       	a = b;
       	b = c;
      }
      
      int count = 0;
      
      for(int i = 1; i <= b; i++){
        if(a % i == 0 && b % i == 0)
        count++;
      }
      
      
      
      int[]d = new int[count];
      int i;
      
      for(i = 0; i < count; i++){
        if(i == 0){
          d[i] = 1;
        } else {
          for(int l = d[i-1]+1; l <= b; l++){
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          }
        }
      }
      
     
     System.out.println(d[count - k]);
      
    } main {
      
      Scanner sc = new Scanner(System.in);
      
      int a = sc.nextInt();
      int b = sc.nextInt();
      int k = sc.nextInt();
      
      int c;
      
      if(b > a){
        c = a;
       	a = b;
       	b = c;
      }
      
      int count = 0;
      
      for(int i = 1; i <= b; i++){
        if(a % i == 0 && b % i == 0)
        count++;
      }
      
      
      
      int[]d = new int[count];
      int i;
      
      for(i = 0; i < count; i++){
        if(i == 0){
          d[i] = 1;
        } else {
          for(int l = d[i-1]+1; l <= b; l++){
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          }
        }
      }
      
     
     System.out.println(d[count - 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 int c; c if(b > a){
        c = a;
       	a = b;
       	b = c;
      } b > a b a {
        c = a;
       	a = b;
       	b = c;
      } c = a c a a = b a b b = c b c int count = 0; count 0 for(int i = 1; i <= b; i++){
        if(a % i == 0 && b % i == 0)
        count++;
      } int i = 1; int i = 1; i 1 i <= b i b i++ i++ i {
        if(a % i == 0 && b % i == 0)
        count++;
      } {
        if(a % i == 0 && b % i == 0)
        count++;
      } if(a % i == 0 && b % i == 0)
        count++; a % i == 0 && b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 count++ count int[]d = new int[count]; d new int[count] count int i; i for(i = 0; i < count; i++){
        if(i == 0){
          d[i] = 1;
        } else {
          for(int l = d[i-1]+1; l <= b; l++){
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          }
        }
      } i = 0; i = 0 i 0 i < count i count i++ i++ i {
        if(i == 0){
          d[i] = 1;
        } else {
          for(int l = d[i-1]+1; l <= b; l++){
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          }
        }
      } {
        if(i == 0){
          d[i] = 1;
        } else {
          for(int l = d[i-1]+1; l <= b; l++){
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          }
        }
      } if(i == 0){
          d[i] = 1;
        } else {
          for(int l = d[i-1]+1; l <= b; l++){
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          }
        } i == 0 i 0 {
          d[i] = 1;
        } d[i] = 1 d[i] d i 1 {
          for(int l = d[i-1]+1; l <= b; l++){
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          }
        } for(int l = d[i-1]+1; l <= b; l++){
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          } int l = d[i-1]+1; int l = d[i-1]+1; l d[i-1]+1 d[i-1] d i-1 i 1 1 l <= b l b l++ l++ l {
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          } {
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          } if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} a % l == 0 && b % l == 0 a % l == 0 a % l a l 0 b % l == 0 b % l b l 0 {
              d[i] = l;
              break;
        	} d[i] = l d[i] d i l break; System.out.println(d[count - k]) System.out.println System.out System System.out d[count - k] d count - k count 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();
      
      int c;
      
      if(b > a){
        c = a;
       	a = b;
       	b = c;
      }
      
      int count = 0;
      
      for(int i = 1; i <= b; i++){
        if(a % i == 0 && b % i == 0)
        count++;
      }
      
      
      
      int[]d = new int[count];
      int i;
      
      for(i = 0; i < count; i++){
        if(i == 0){
          d[i] = 1;
        } else {
          for(int l = d[i-1]+1; l <= b; l++){
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          }
        }
      }
      
     
     System.out.println(d[count - 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 c;
      
      if(b > a){
        c = a;
       	a = b;
       	b = c;
      }
      
      int count = 0;
      
      for(int i = 1; i <= b; i++){
        if(a % i == 0 && b % i == 0)
        count++;
      }
      
      
      
      int[]d = new int[count];
      int i;
      
      for(i = 0; i < count; i++){
        if(i == 0){
          d[i] = 1;
        } else {
          for(int l = d[i-1]+1; l <= b; l++){
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          }
        }
      }
      
     
     System.out.println(d[count - 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();
      
      int c;
      
      if(b > a){
        c = a;
       	a = b;
       	b = c;
      }
      
      int count = 0;
      
      for(int i = 1; i <= b; i++){
        if(a % i == 0 && b % i == 0)
        count++;
      }
      
      
      
      int[]d = new int[count];
      int i;
      
      for(i = 0; i < count; i++){
        if(i == 0){
          d[i] = 1;
        } else {
          for(int l = d[i-1]+1; l <= b; l++){
            if(a % l == 0 && b % l == 0){
              d[i] = l;
              break;
        	} 
          }
        }
      }
      
     
     System.out.println(d[count - k]);
      
    }
}