import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)) {
			int A = Integer.parseInt(sc.next());
			int B = Integer.parseInt(sc.next());
			int K = Integer.parseInt(sc.next());
			List<Integer> l = new ArrayList<Integer>();
			for(int i = 1; i <= Math.min(A, B); i++) {
				if(A % i == 0 && B % i == 0) {
					l.add(0, i);
				}
			}
			System.out.println(l.get(K - 1));
		} // Scanner Close
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)) {
			int A = Integer.parseInt(sc.next());
			int B = Integer.parseInt(sc.next());
			int K = Integer.parseInt(sc.next());
			List<Integer> l = new ArrayList<Integer>();
			for(int i = 1; i <= Math.min(A, B); i++) {
				if(A % i == 0 && B % i == 0) {
					l.add(0, i);
				}
			}
			System.out.println(l.get(K - 1));
		} // Scanner Close
	}
} Main public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)) {
			int A = Integer.parseInt(sc.next());
			int B = Integer.parseInt(sc.next());
			int K = Integer.parseInt(sc.next());
			List<Integer> l = new ArrayList<Integer>();
			for(int i = 1; i <= Math.min(A, B); i++) {
				if(A % i == 0 && B % i == 0) {
					l.add(0, i);
				}
			}
			System.out.println(l.get(K - 1));
		} // Scanner Close
	} main {

		try (Scanner sc = new Scanner(System.in)) {
			int A = Integer.parseInt(sc.next());
			int B = Integer.parseInt(sc.next());
			int K = Integer.parseInt(sc.next());
			List<Integer> l = new ArrayList<Integer>();
			for(int i = 1; i <= Math.min(A, B); i++) {
				if(A % i == 0 && B % i == 0) {
					l.add(0, i);
				}
			}
			System.out.println(l.get(K - 1));
		} // Scanner Close
	} try (Scanner sc = new Scanner(System.in)) {
			int A = Integer.parseInt(sc.next());
			int B = Integer.parseInt(sc.next());
			int K = Integer.parseInt(sc.next());
			List<Integer> l = new ArrayList<Integer>();
			for(int i = 1; i <= Math.min(A, B); i++) {
				if(A % i == 0 && B % i == 0) {
					l.add(0, i);
				}
			}
			System.out.println(l.get(K - 1));
		} // Scanner Close {
			int A = Integer.parseInt(sc.next());
			int B = Integer.parseInt(sc.next());
			int K = Integer.parseInt(sc.next());
			List<Integer> l = new ArrayList<Integer>();
			for(int i = 1; i <= Math.min(A, B); i++) {
				if(A % i == 0 && B % i == 0) {
					l.add(0, i);
				}
			}
			System.out.println(l.get(K - 1));
		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int A = Integer.parseInt(sc.next()); A Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int B = Integer.parseInt(sc.next()); B Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int K = Integer.parseInt(sc.next()); K Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc List<Integer> l = new ArrayList<Integer>(); l new ArrayList<Integer>() for(int i = 1; i <= Math.min(A, B); i++) {
				if(A % i == 0 && B % i == 0) {
					l.add(0, i);
				}
			} int i = 1; int i = 1; i 1 i <= Math.min(A, B) i Math.min(A, B) Math.min Math A B i++ i++ i {
				if(A % i == 0 && B % i == 0) {
					l.add(0, i);
				}
			} {
				if(A % i == 0 && B % i == 0) {
					l.add(0, i);
				}
			} if(A % i == 0 && B % i == 0) {
					l.add(0, i);
				} A % i == 0 && B % i == 0 A % i == 0 A % i A i 0 B % i == 0 B % i B i 0 {
					l.add(0, i);
				} l.add(0, i) l.add l 0 i System.out.println(l.get(K - 1)) System.out.println System.out System System.out l.get(K - 1) l.get l K - 1 K 1 String[] args args public class Main {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)) {
			int A = Integer.parseInt(sc.next());
			int B = Integer.parseInt(sc.next());
			int K = Integer.parseInt(sc.next());
			List<Integer> l = new ArrayList<Integer>();
			for(int i = 1; i <= Math.min(A, B); i++) {
				if(A % i == 0 && B % i == 0) {
					l.add(0, i);
				}
			}
			System.out.println(l.get(K - 1));
		} // Scanner Close
	}
} public class Main {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)) {
			int A = Integer.parseInt(sc.next());
			int B = Integer.parseInt(sc.next());
			int K = Integer.parseInt(sc.next());
			List<Integer> l = new ArrayList<Integer>();
			for(int i = 1; i <= Math.min(A, B); i++) {
				if(A % i == 0 && B % i == 0) {
					l.add(0, i);
				}
			}
			System.out.println(l.get(K - 1));
		} // Scanner Close
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)) {
			int A = Integer.parseInt(sc.next());
			int B = Integer.parseInt(sc.next());
			int K = Integer.parseInt(sc.next());
			List<Integer> l = new ArrayList<Integer>();
			for(int i = 1; i <= Math.min(A, B); i++) {
				if(A % i == 0 && B % i == 0) {
					l.add(0, i);
				}
			}
			System.out.println(l.get(K - 1));
		} // Scanner Close
	}
}