import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int a = scan.nextInt();
	int b = scan.nextInt();
	int k = scan.nextInt();

	int divide = 1;
	for(int i = 100; i >= 1; i--){
	    if(a % i == 0 && b % i == 0){
		k--;
	    }
	    if(k == 0){
		divide = i;
		break;
	    }
	}

	System.out.println(divide);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int a = scan.nextInt();
	int b = scan.nextInt();
	int k = scan.nextInt();

	int divide = 1;
	for(int i = 100; i >= 1; i--){
	    if(a % i == 0 && b % i == 0){
		k--;
	    }
	    if(k == 0){
		divide = i;
		break;
	    }
	}

	System.out.println(divide);
    }
} Main public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int a = scan.nextInt();
	int b = scan.nextInt();
	int k = scan.nextInt();

	int divide = 1;
	for(int i = 100; i >= 1; i--){
	    if(a % i == 0 && b % i == 0){
		k--;
	    }
	    if(k == 0){
		divide = i;
		break;
	    }
	}

	System.out.println(divide);
    } main {
	Scanner scan = new Scanner(System.in);

	int a = scan.nextInt();
	int b = scan.nextInt();
	int k = scan.nextInt();

	int divide = 1;
	for(int i = 100; i >= 1; i--){
	    if(a % i == 0 && b % i == 0){
		k--;
	    }
	    if(k == 0){
		divide = i;
		break;
	    }
	}

	System.out.println(divide);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int a = scan.nextInt(); a scan.nextInt() scan.nextInt scan int b = scan.nextInt(); b scan.nextInt() scan.nextInt scan int k = scan.nextInt(); k scan.nextInt() scan.nextInt scan int divide = 1; divide 1 for(int i = 100; i >= 1; i--){
	    if(a % i == 0 && b % i == 0){
		k--;
	    }
	    if(k == 0){
		divide = i;
		break;
	    }
	} int i = 100; int i = 100; i 100 i >= 1 i 1 i-- i-- i {
	    if(a % i == 0 && b % i == 0){
		k--;
	    }
	    if(k == 0){
		divide = i;
		break;
	    }
	} {
	    if(a % i == 0 && b % i == 0){
		k--;
	    }
	    if(k == 0){
		divide = i;
		break;
	    }
	} if(a % i == 0 && b % i == 0){
		k--;
	    } a % i == 0 && b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 {
		k--;
	    } k-- k if(k == 0){
		divide = i;
		break;
	    } k == 0 k 0 {
		divide = i;
		break;
	    } divide = i divide i break; System.out.println(divide) System.out.println System.out System System.out divide String[] args args public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int a = scan.nextInt();
	int b = scan.nextInt();
	int k = scan.nextInt();

	int divide = 1;
	for(int i = 100; i >= 1; i--){
	    if(a % i == 0 && b % i == 0){
		k--;
	    }
	    if(k == 0){
		divide = i;
		break;
	    }
	}

	System.out.println(divide);
    }
} public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int a = scan.nextInt();
	int b = scan.nextInt();
	int k = scan.nextInt();

	int divide = 1;
	for(int i = 100; i >= 1; i--){
	    if(a % i == 0 && b % i == 0){
		k--;
	    }
	    if(k == 0){
		divide = i;
		break;
	    }
	}

	System.out.println(divide);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int a = scan.nextInt();
	int b = scan.nextInt();
	int k = scan.nextInt();

	int divide = 1;
	for(int i = 100; i >= 1; i--){
	    if(a % i == 0 && b % i == 0){
		k--;
	    }
	    if(k == 0){
		divide = i;
		break;
	    }
	}

	System.out.println(divide);
    }
}
