import 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 C = sc.nextInt();
    int a = A;
    int b = B;
    int max = A;
    int count = 0;
    if(A<B)max=B;
    for(int i = max;i > 0;i--){
      if(A%i==0&&B%i==0)count++;
      if(count == C){
        a = i;  
        break;
      }
    }
    System.out.println(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();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int a = A;
    int b = B;
    int max = A;
    int count = 0;
    if(A<B)max=B;
    for(int i = max;i > 0;i--){
      if(A%i==0&&B%i==0)count++;
      if(count == C){
        a = i;  
        break;
      }
    }
    System.out.println(a);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int a = A;
    int b = B;
    int max = A;
    int count = 0;
    if(A<B)max=B;
    for(int i = max;i > 0;i--){
      if(A%i==0&&B%i==0)count++;
      if(count == C){
        a = i;  
        break;
      }
    }
    System.out.println(a);
  } main {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int a = A;
    int b = B;
    int max = A;
    int count = 0;
    if(A<B)max=B;
    for(int i = max;i > 0;i--){
      if(A%i==0&&B%i==0)count++;
      if(count == C){
        a = i;  
        break;
      }
    }
    System.out.println(a);
  } 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 a = A; a A int b = B; b B int max = A; max A int count = 0; count 0 if(A<B)max=B; A<B A B max=B max B for(int i = max;i > 0;i--){
      if(A%i==0&&B%i==0)count++;
      if(count == C){
        a = i;  
        break;
      }
    } int i = max; int i = max; i max i > 0 i 0 i-- i-- i {
      if(A%i==0&&B%i==0)count++;
      if(count == C){
        a = i;  
        break;
      }
    } {
      if(A%i==0&&B%i==0)count++;
      if(count == C){
        a = i;  
        break;
      }
    } 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 if(count == C){
        a = i;  
        break;
      } count == C count C {
        a = i;  
        break;
      } a = i a i break; System.out.println(a) System.out.println System.out System System.out a 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 C = sc.nextInt();
    int a = A;
    int b = B;
    int max = A;
    int count = 0;
    if(A<B)max=B;
    for(int i = max;i > 0;i--){
      if(A%i==0&&B%i==0)count++;
      if(count == C){
        a = i;  
        break;
      }
    }
    System.out.println(a);
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int a = A;
    int b = B;
    int max = A;
    int count = 0;
    if(A<B)max=B;
    for(int i = max;i > 0;i--){
      if(A%i==0&&B%i==0)count++;
      if(count == C){
        a = i;  
        break;
      }
    }
    System.out.println(a);
  }
} Main
import 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 C = sc.nextInt();
    int a = A;
    int b = B;
    int max = A;
    int count = 0;
    if(A<B)max=B;
    for(int i = max;i > 0;i--){
      if(A%i==0&&B%i==0)count++;
      if(count == C){
        a = i;  
        break;
      }
    }
    System.out.println(a);
  }
}
