import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception {
		Scanner s = new Scanner(System.in);
		int A = s.nextInt(), B = s.nextInt(), K = s.nextInt(), k = 0, i = A;
		while (B > 0){
			int C = Math.min(A, B);
			B = Math.max(A, B) % C;
			A = C;
		}
		for (i = A;; i--){
			if (A % i == 0){
				k++;
			}
			if (k == K){
				System.out.println(i);
				break;
			}
		}
		
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args) throws Exception {
		Scanner s = new Scanner(System.in);
		int A = s.nextInt(), B = s.nextInt(), K = s.nextInt(), k = 0, i = A;
		while (B > 0){
			int C = Math.min(A, B);
			B = Math.max(A, B) % C;
			A = C;
		}
		for (i = A;; i--){
			if (A % i == 0){
				k++;
			}
			if (k == K){
				System.out.println(i);
				break;
			}
		}
		
	}
} Main public static void main(String[] args) throws Exception {
		Scanner s = new Scanner(System.in);
		int A = s.nextInt(), B = s.nextInt(), K = s.nextInt(), k = 0, i = A;
		while (B > 0){
			int C = Math.min(A, B);
			B = Math.max(A, B) % C;
			A = C;
		}
		for (i = A;; i--){
			if (A % i == 0){
				k++;
			}
			if (k == K){
				System.out.println(i);
				break;
			}
		}
		
	} main {
		Scanner s = new Scanner(System.in);
		int A = s.nextInt(), B = s.nextInt(), K = s.nextInt(), k = 0, i = A;
		while (B > 0){
			int C = Math.min(A, B);
			B = Math.max(A, B) % C;
			A = C;
		}
		for (i = A;; i--){
			if (A % i == 0){
				k++;
			}
			if (k == K){
				System.out.println(i);
				break;
			}
		}
		
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int A = s.nextInt() A s.nextInt() s.nextInt s B = s.nextInt() B s.nextInt() s.nextInt s K = s.nextInt() K s.nextInt() s.nextInt s k = 0 k 0 i = A; i A while (B > 0){
			int C = Math.min(A, B);
			B = Math.max(A, B) % C;
			A = C;
		} B > 0 B 0 {
			int C = Math.min(A, B);
			B = Math.max(A, B) % C;
			A = C;
		} int C = Math.min(A, B); C Math.min(A, B) Math.min Math A B B = Math.max(A, B) % C B Math.max(A, B) % C Math.max(A, B) Math.max Math A B C A = C A C for (i = A;; i--){
			if (A % i == 0){
				k++;
			}
			if (k == K){
				System.out.println(i);
				break;
			}
		} i = A; i = A i A i-- i-- i {
			if (A % i == 0){
				k++;
			}
			if (k == K){
				System.out.println(i);
				break;
			}
		} {
			if (A % i == 0){
				k++;
			}
			if (k == K){
				System.out.println(i);
				break;
			}
		} if (A % i == 0){
				k++;
			} A % i == 0 A % i A i 0 {
				k++;
			} k++ k if (k == K){
				System.out.println(i);
				break;
			} k == K k K {
				System.out.println(i);
				break;
			} System.out.println(i) System.out.println System.out System System.out i break; String[] args args public class Main{
	public static void main(String[] args) throws Exception {
		Scanner s = new Scanner(System.in);
		int A = s.nextInt(), B = s.nextInt(), K = s.nextInt(), k = 0, i = A;
		while (B > 0){
			int C = Math.min(A, B);
			B = Math.max(A, B) % C;
			A = C;
		}
		for (i = A;; i--){
			if (A % i == 0){
				k++;
			}
			if (k == K){
				System.out.println(i);
				break;
			}
		}
		
	}
} public class Main{
	public static void main(String[] args) throws Exception {
		Scanner s = new Scanner(System.in);
		int A = s.nextInt(), B = s.nextInt(), K = s.nextInt(), k = 0, i = A;
		while (B > 0){
			int C = Math.min(A, B);
			B = Math.max(A, B) % C;
			A = C;
		}
		for (i = A;; i--){
			if (A % i == 0){
				k++;
			}
			if (k == K){
				System.out.println(i);
				break;
			}
		}
		
	}
} Main
import java.util.*;

public class Main{
	public static void main(String[] args) throws Exception {
		Scanner s = new Scanner(System.in);
		int A = s.nextInt(), B = s.nextInt(), K = s.nextInt(), k = 0, i = A;
		while (B > 0){
			int C = Math.min(A, B);
			B = Math.max(A, B) % C;
			A = C;
		}
		for (i = A;; i--){
			if (A % i == 0){
				k++;
			}
			if (k == K){
				System.out.println(i);
				break;
			}
		}
		
	}
}
