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 r = 1;
    int cnt = 0;


    for(int i = 100; i > 0; i--) {
    	if(k > cnt) {
    		if(a % i == 0 && b % i == 0) {
    			r = i;
    			cnt++;
    		}
    	}
    	else {
    		break;
    	}
    }
    System.out.println(r);
  }
} 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 r = 1;
    int cnt = 0;


    for(int i = 100; i > 0; i--) {
    	if(k > cnt) {
    		if(a % i == 0 && b % i == 0) {
    			r = i;
    			cnt++;
    		}
    	}
    	else {
    		break;
    	}
    }
    System.out.println(r);
  }
} 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 r = 1;
    int cnt = 0;


    for(int i = 100; i > 0; i--) {
    	if(k > cnt) {
    		if(a % i == 0 && b % i == 0) {
    			r = i;
    			cnt++;
    		}
    	}
    	else {
    		break;
    	}
    }
    System.out.println(r);
  } main {
    Scanner sc = new Scanner(System.in);

    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();
    int r = 1;
    int cnt = 0;


    for(int i = 100; i > 0; i--) {
    	if(k > cnt) {
    		if(a % i == 0 && b % i == 0) {
    			r = i;
    			cnt++;
    		}
    	}
    	else {
    		break;
    	}
    }
    System.out.println(r);
  } 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 r = 1; r 1 int cnt = 0; cnt 0 for(int i = 100; i > 0; i--) {
    	if(k > cnt) {
    		if(a % i == 0 && b % i == 0) {
    			r = i;
    			cnt++;
    		}
    	}
    	else {
    		break;
    	}
    } int i = 100; int i = 100; i 100 i > 0 i 0 i-- i-- i {
    	if(k > cnt) {
    		if(a % i == 0 && b % i == 0) {
    			r = i;
    			cnt++;
    		}
    	}
    	else {
    		break;
    	}
    } {
    	if(k > cnt) {
    		if(a % i == 0 && b % i == 0) {
    			r = i;
    			cnt++;
    		}
    	}
    	else {
    		break;
    	}
    } if(k > cnt) {
    		if(a % i == 0 && b % i == 0) {
    			r = i;
    			cnt++;
    		}
    	}
    	else {
    		break;
    	} k > cnt k cnt {
    		if(a % i == 0 && b % i == 0) {
    			r = i;
    			cnt++;
    		}
    	} if(a % i == 0 && b % i == 0) {
    			r = i;
    			cnt++;
    		} a % i == 0 && b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 {
    			r = i;
    			cnt++;
    		} r = i r i cnt++ cnt {
    		break;
    	} break; System.out.println(r) System.out.println System.out System System.out r 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 r = 1;
    int cnt = 0;


    for(int i = 100; i > 0; i--) {
    	if(k > cnt) {
    		if(a % i == 0 && b % i == 0) {
    			r = i;
    			cnt++;
    		}
    	}
    	else {
    		break;
    	}
    }
    System.out.println(r);
  }
} 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 r = 1;
    int cnt = 0;


    for(int i = 100; i > 0; i--) {
    	if(k > cnt) {
    		if(a % i == 0 && b % i == 0) {
    			r = i;
    			cnt++;
    		}
    	}
    	else {
    		break;
    	}
    }
    System.out.println(r);
  }
} 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 r = 1;
    int cnt = 0;


    for(int i = 100; i > 0; i--) {
    	if(k > cnt) {
    		if(a % i == 0 && b % i == 0) {
    			r = i;
    			cnt++;
    		}
    	}
    	else {
    		break;
    	}
    }
    System.out.println(r);
  }
}
