import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.TreeSet;

import org.omg.Messaging.SyncScopeHelper;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new Test_200().doIt();
	}
	class Test_200{
		void doIt() {
			int A = sc.nextInt();
			int B = sc.nextInt();
			int K = sc.nextInt();
			for(int i = 100;i >= 1;i--) {
				if(A % i == 0 && B % i == 0)K = K - 1;
				if(K == 0) {
					System.out.println(i);
					break;
				}
			}
		}
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util import java.util.TreeSet; TreeSet java.util import org.omg.Messaging.SyncScopeHelper; SyncScopeHelper org.omg.Messaging public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new Test_200().doIt();
	}
	class Test_200{
		void doIt() {
			int A = sc.nextInt();
			int B = sc.nextInt();
			int K = sc.nextInt();
			for(int i = 100;i >= 1;i--) {
				if(A % i == 0 && B % i == 0)K = K - 1;
				if(K == 0) {
					System.out.println(i);
					break;
				}
			}
		}
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args){
		new Main();
	} main {
		new Main();
	} new Main() String[] args args public Main(){
		new Test_200().doIt();
	} Main {
		new Test_200().doIt();
	} new Test_200().doIt() new Test_200().doIt new Test_200() class Test_200{
		void doIt() {
			int A = sc.nextInt();
			int B = sc.nextInt();
			int K = sc.nextInt();
			for(int i = 100;i >= 1;i--) {
				if(A % i == 0 && B % i == 0)K = K - 1;
				if(K == 0) {
					System.out.println(i);
					break;
				}
			}
		}
	} Test_200 void doIt() {
			int A = sc.nextInt();
			int B = sc.nextInt();
			int K = sc.nextInt();
			for(int i = 100;i >= 1;i--) {
				if(A % i == 0 && B % i == 0)K = K - 1;
				if(K == 0) {
					System.out.println(i);
					break;
				}
			}
		} doIt {
			int A = sc.nextInt();
			int B = sc.nextInt();
			int K = sc.nextInt();
			for(int i = 100;i >= 1;i--) {
				if(A % i == 0 && B % i == 0)K = K - 1;
				if(K == 0) {
					System.out.println(i);
					break;
				}
			}
		} 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 for(int i = 100;i >= 1;i--) {
				if(A % i == 0 && B % i == 0)K = K - 1;
				if(K == 0) {
					System.out.println(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 = K - 1;
				if(K == 0) {
					System.out.println(i);
					break;
				}
			} {
				if(A % i == 0 && B % i == 0)K = K - 1;
				if(K == 0) {
					System.out.println(i);
					break;
				}
			} if(A % i == 0 && B % i == 0)K = K - 1; A % i == 0 && B % i == 0 A % i == 0 A % i A i 0 B % i == 0 B % i B i 0 K = K - 1 K K - 1 K 1 if(K == 0) {
					System.out.println(i);
					break;
				} K == 0 K 0 {
					System.out.println(i);
					break;
				} System.out.println(i) System.out.println System.out System System.out i break; public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new Test_200().doIt();
	}
	class Test_200{
		void doIt() {
			int A = sc.nextInt();
			int B = sc.nextInt();
			int K = sc.nextInt();
			for(int i = 100;i >= 1;i--) {
				if(A % i == 0 && B % i == 0)K = K - 1;
				if(K == 0) {
					System.out.println(i);
					break;
				}
			}
		}
	}
} public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new Test_200().doIt();
	}
	class Test_200{
		void doIt() {
			int A = sc.nextInt();
			int B = sc.nextInt();
			int K = sc.nextInt();
			for(int i = 100;i >= 1;i--) {
				if(A % i == 0 && B % i == 0)K = K - 1;
				if(K == 0) {
					System.out.println(i);
					break;
				}
			}
		}
	}
} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.TreeSet;

import org.omg.Messaging.SyncScopeHelper;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
		new Test_200().doIt();
	}
	class Test_200{
		void doIt() {
			int A = sc.nextInt();
			int B = sc.nextInt();
			int K = sc.nextInt();
			for(int i = 100;i >= 1;i--) {
				if(A % i == 0 && B % i == 0)K = K - 1;
				if(K == 0) {
					System.out.println(i);
					break;
				}
			}
		}
	}
}
