import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int max_num = Math.max(A,B);
    ArrayList<Integer> num = new ArrayList<Integer>();
    
    for(int i=1;i<=max_num;i++){
     if(B%i==0&&A%i==0){
      num.add(i);
     }
    }
    
    int size=num.size();
    System.out.println(num.get(size-C));
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int max_num = Math.max(A,B);
    ArrayList<Integer> num = new ArrayList<Integer>();
    
    for(int i=1;i<=max_num;i++){
     if(B%i==0&&A%i==0){
      num.add(i);
     }
    }
    
    int size=num.size();
    System.out.println(num.get(size-C));
  }
} Main public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int max_num = Math.max(A,B);
    ArrayList<Integer> num = new ArrayList<Integer>();
    
    for(int i=1;i<=max_num;i++){
     if(B%i==0&&A%i==0){
      num.add(i);
     }
    }
    
    int size=num.size();
    System.out.println(num.get(size-C));
  } main {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int max_num = Math.max(A,B);
    ArrayList<Integer> num = new ArrayList<Integer>();
    
    for(int i=1;i<=max_num;i++){
     if(B%i==0&&A%i==0){
      num.add(i);
     }
    }
    
    int size=num.size();
    System.out.println(num.get(size-C));
  } 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 C = sc.nextInt(); C sc.nextInt() sc.nextInt sc int max_num = Math.max(A,B); max_num Math.max(A,B) Math.max Math A B ArrayList<Integer> num = new ArrayList<Integer>(); num new ArrayList<Integer>() for(int i=1;i<=max_num;i++){
     if(B%i==0&&A%i==0){
      num.add(i);
     }
    } int i=1; int i=1; i 1 i<=max_num i max_num i++ i++ i {
     if(B%i==0&&A%i==0){
      num.add(i);
     }
    } {
     if(B%i==0&&A%i==0){
      num.add(i);
     }
    } if(B%i==0&&A%i==0){
      num.add(i);
     } B%i==0&&A%i==0 B%i==0 B%i B i 0 A%i==0 A%i A i 0 {
      num.add(i);
     } num.add(i) num.add num i int size=num.size(); size num.size() num.size num System.out.println(num.get(size-C)) System.out.println System.out System System.out num.get(size-C) num.get num size-C size C String[] args args public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int max_num = Math.max(A,B);
    ArrayList<Integer> num = new ArrayList<Integer>();
    
    for(int i=1;i<=max_num;i++){
     if(B%i==0&&A%i==0){
      num.add(i);
     }
    }
    
    int size=num.size();
    System.out.println(num.get(size-C));
  }
} public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int max_num = Math.max(A,B);
    ArrayList<Integer> num = new ArrayList<Integer>();
    
    for(int i=1;i<=max_num;i++){
     if(B%i==0&&A%i==0){
      num.add(i);
     }
    }
    
    int size=num.size();
    System.out.println(num.get(size-C));
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int max_num = Math.max(A,B);
    ArrayList<Integer> num = new ArrayList<Integer>();
    
    for(int i=1;i<=max_num;i++){
     if(B%i==0&&A%i==0){
      num.add(i);
     }
    }
    
    int size=num.size();
    System.out.println(num.get(size-C));
  }
}