import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A =sc.nextInt();
		int B =sc.nextInt();
		int K =sc.nextInt();
		int count =0;
		if(A<B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A>B){
			for(int i=B;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A==B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
	}
} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A =sc.nextInt();
		int B =sc.nextInt();
		int K =sc.nextInt();
		int count =0;
		if(A<B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A>B){
			for(int i=B;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A==B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A =sc.nextInt();
		int B =sc.nextInt();
		int K =sc.nextInt();
		int count =0;
		if(A<B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A>B){
			for(int i=B;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A==B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int A =sc.nextInt();
		int B =sc.nextInt();
		int K =sc.nextInt();
		int count =0;
		if(A<B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A>B){
			for(int i=B;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A==B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
	} 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 if(A<B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A>B){
			for(int i=B;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A==B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		} A<B A B {
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		} for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			} int i=A; int i=A; i A i>=1 i 1 i-- i-- i {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			} {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			} if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				} A%i==0&&B%i==0 A%i==0 A%i A i 0 B%i==0 B%i B i 0 {
					count++;
					if(count==K){
						System.out.println(i);
					}
				} count++ count if(count==K){
						System.out.println(i);
					} count==K count K {
						System.out.println(i);
					} System.out.println(i) System.out.println System.out System System.out i if(A>B){
			for(int i=B;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A==B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		} A>B A B {
			for(int i=B;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		} for(int i=B;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			} int i=B; int i=B; i B i>=1 i 1 i-- i-- i {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			} {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			} if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				} A%i==0&&B%i==0 A%i==0 A%i A i 0 B%i==0 B%i B i 0 {
					count++;
					if(count==K){
						System.out.println(i);
					}
				} count++ count if(count==K){
						System.out.println(i);
					} count==K count K {
						System.out.println(i);
					} System.out.println(i) System.out.println System.out System System.out i if(A==B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		} A==B A B {
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		} for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			} int i=A; int i=A; i A i>=1 i 1 i-- i-- i {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			} {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			} if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				} A%i==0&&B%i==0 A%i==0 A%i A i 0 B%i==0 B%i B i 0 {
					count++;
					if(count==K){
						System.out.println(i);
					}
				} count++ count if(count==K){
						System.out.println(i);
					} count==K count K {
						System.out.println(i);
					} System.out.println(i) System.out.println System.out System System.out i String[] args args public class Main {

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A =sc.nextInt();
		int B =sc.nextInt();
		int K =sc.nextInt();
		int count =0;
		if(A<B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A>B){
			for(int i=B;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A==B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
	}
} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A =sc.nextInt();
		int B =sc.nextInt();
		int K =sc.nextInt();
		int count =0;
		if(A<B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A>B){
			for(int i=B;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
		else if(A==B){
			for(int i=A;i>=1;i--) {
				if(A%i==0&&B%i==0) {
					count++;
					if(count==K){
						System.out.println(i);
					}
				}
			}
		}
	}
}
