import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	void doIt() {
		sB();
	}

	void sB() {
		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--;
				if(k == 0) {
					System.out.println(i);
					return;
				
				}
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
} import java.util.*; util.* java public class Main {
	Scanner sc = new Scanner(System.in);

	void doIt() {
		sB();
	}

	void sB() {
		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--;
				if(k == 0) {
					System.out.println(i);
					return;
				
				}
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) void doIt() {
		sB();
	} doIt {
		sB();
	} sB() sB void sB() {
		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--;
				if(k == 0) {
					System.out.println(i);
					return;
				
				}
			}
		}
	} sB {
		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--;
				if(k == 0) {
					System.out.println(i);
					return;
				
				}
			}
		}
	} 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--;
				if(k == 0) {
					System.out.println(i);
					return;
				
				}
			}
		} 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) {
					System.out.println(i);
					return;
				
				}
			}
		} {
			if(a % i == 0 && b % i == 0) {
				k--;
				if(k == 0) {
					System.out.println(i);
					return;
				
				}
			}
		} if(a % i == 0 && b % i == 0) {
				k--;
				if(k == 0) {
					System.out.println(i);
					return;
				
				}
			} a % i == 0 && b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 {
				k--;
				if(k == 0) {
					System.out.println(i);
					return;
				
				}
			} k-- k if(k == 0) {
					System.out.println(i);
					return;
				
				} k == 0 k 0 {
					System.out.println(i);
					return;
				
				} System.out.println(i) System.out.println System.out System System.out i return; public static void main(String[] args) {
		new Main().doIt();
	} main {
		new Main().doIt();
	} new Main().doIt() new Main().doIt new Main() String[] args args public class Main {
	Scanner sc = new Scanner(System.in);

	void doIt() {
		sB();
	}

	void sB() {
		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--;
				if(k == 0) {
					System.out.println(i);
					return;
				
				}
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
} public class Main {
	Scanner sc = new Scanner(System.in);

	void doIt() {
		sB();
	}

	void sB() {
		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--;
				if(k == 0) {
					System.out.println(i);
					return;
				
				}
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
} Main
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	void doIt() {
		sB();
	}

	void sB() {
		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--;
				if(k == 0) {
					System.out.println(i);
					return;
				
				}
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().doIt();
	}
}
