
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int a=scn.nextInt();
		int b=scn.nextInt();
		int c=scn.nextInt();
		if(b<a) {
			int t=b;
			b=a;
			a=t;
		}
		int cnt=0;
		for(int i=a;i>=1;i--) {
			if(b%i==0&&a%i==0) {
				cnt++;
			}
			if(cnt==c) {
				System.out.println(i);
				break;
			}
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int a=scn.nextInt();
		int b=scn.nextInt();
		int c=scn.nextInt();
		if(b<a) {
			int t=b;
			b=a;
			a=t;
		}
		int cnt=0;
		for(int i=a;i>=1;i--) {
			if(b%i==0&&a%i==0) {
				cnt++;
			}
			if(cnt==c) {
				System.out.println(i);
				break;
			}
		}
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int a=scn.nextInt();
		int b=scn.nextInt();
		int c=scn.nextInt();
		if(b<a) {
			int t=b;
			b=a;
			a=t;
		}
		int cnt=0;
		for(int i=a;i>=1;i--) {
			if(b%i==0&&a%i==0) {
				cnt++;
			}
			if(cnt==c) {
				System.out.println(i);
				break;
			}
		}
	} main {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int a=scn.nextInt();
		int b=scn.nextInt();
		int c=scn.nextInt();
		if(b<a) {
			int t=b;
			b=a;
			a=t;
		}
		int cnt=0;
		for(int i=a;i>=1;i--) {
			if(b%i==0&&a%i==0) {
				cnt++;
			}
			if(cnt==c) {
				System.out.println(i);
				break;
			}
		}
	} Scanner scn=new Scanner(System.in); scn new Scanner(System.in) int a=scn.nextInt(); a scn.nextInt() scn.nextInt scn int b=scn.nextInt(); b scn.nextInt() scn.nextInt scn int c=scn.nextInt(); c scn.nextInt() scn.nextInt scn if(b<a) {
			int t=b;
			b=a;
			a=t;
		} b<a b a {
			int t=b;
			b=a;
			a=t;
		} int t=b; t b b=a b a a=t a t int cnt=0; cnt 0 for(int i=a;i>=1;i--) {
			if(b%i==0&&a%i==0) {
				cnt++;
			}
			if(cnt==c) {
				System.out.println(i);
				break;
			}
		} int i=a; int i=a; i a i>=1 i 1 i-- i-- i {
			if(b%i==0&&a%i==0) {
				cnt++;
			}
			if(cnt==c) {
				System.out.println(i);
				break;
			}
		} {
			if(b%i==0&&a%i==0) {
				cnt++;
			}
			if(cnt==c) {
				System.out.println(i);
				break;
			}
		} if(b%i==0&&a%i==0) {
				cnt++;
			} b%i==0&&a%i==0 b%i==0 b%i b i 0 a%i==0 a%i a i 0 {
				cnt++;
			} cnt++ cnt if(cnt==c) {
				System.out.println(i);
				break;
			} cnt==c cnt c {
				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) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int a=scn.nextInt();
		int b=scn.nextInt();
		int c=scn.nextInt();
		if(b<a) {
			int t=b;
			b=a;
			a=t;
		}
		int cnt=0;
		for(int i=a;i>=1;i--) {
			if(b%i==0&&a%i==0) {
				cnt++;
			}
			if(cnt==c) {
				System.out.println(i);
				break;
			}
		}
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int a=scn.nextInt();
		int b=scn.nextInt();
		int c=scn.nextInt();
		if(b<a) {
			int t=b;
			b=a;
			a=t;
		}
		int cnt=0;
		for(int i=a;i>=1;i--) {
			if(b%i==0&&a%i==0) {
				cnt++;
			}
			if(cnt==c) {
				System.out.println(i);
				break;
			}
		}
	}

} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		int a=scn.nextInt();
		int b=scn.nextInt();
		int c=scn.nextInt();
		if(b<a) {
			int t=b;
			b=a;
			a=t;
		}
		int cnt=0;
		for(int i=a;i>=1;i--) {
			if(b%i==0&&a%i==0) {
				cnt++;
			}
			if(cnt==c) {
				System.out.println(i);
				break;
			}
		}
	}

}
