
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		int count = 0;
		int i = 100;
		while(count < k) {
			if(a%i == 0 && b%i == 0) {
				count++;
			}
			i--;
		}
		System.out.println(i+1);
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		int count = 0;
		int i = 100;
		while(count < k) {
			if(a%i == 0 && b%i == 0) {
				count++;
			}
			i--;
		}
		System.out.println(i+1);
		sc.close();
	}
} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		int count = 0;
		int i = 100;
		while(count < k) {
			if(a%i == 0 && b%i == 0) {
				count++;
			}
			i--;
		}
		System.out.println(i+1);
		sc.close();
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		int count = 0;
		int i = 100;
		while(count < k) {
			if(a%i == 0 && b%i == 0) {
				count++;
			}
			i--;
		}
		System.out.println(i+1);
		sc.close();
	} 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 count = 0; count 0 int i = 100; i 100 while(count < k) {
			if(a%i == 0 && b%i == 0) {
				count++;
			}
			i--;
		} count < k count k {
			if(a%i == 0 && b%i == 0) {
				count++;
			}
			i--;
		} if(a%i == 0 && b%i == 0) {
				count++;
			} a%i == 0 && b%i == 0 a%i == 0 a%i a i 0 b%i == 0 b%i b i 0 {
				count++;
			} count++ count i-- i System.out.println(i+1) System.out.println System.out System System.out i+1 i 1 sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		int count = 0;
		int i = 100;
		while(count < k) {
			if(a%i == 0 && b%i == 0) {
				count++;
			}
			i--;
		}
		System.out.println(i+1);
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		int count = 0;
		int i = 100;
		while(count < k) {
			if(a%i == 0 && b%i == 0) {
				count++;
			}
			i--;
		}
		System.out.println(i+1);
		sc.close();
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();
		int count = 0;
		int i = 100;
		while(count < k) {
			if(a%i == 0 && b%i == 0) {
				count++;
			}
			i--;
		}
		System.out.println(i+1);
		sc.close();
	}
}
