import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class Main {
	static Scanner sc = new Scanner(System.in);
	
	public static void main (String [] args){
		ArrayList <Integer> list = new ArrayList<Integer>();
//		String [][] boad = new String[4][4];
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());

		int c = Integer.parseInt(sc.next());
//		int d = Integer.parseInt(sc.next());
		int count = 0;
		if(a<b){
			for(int i = 0; i < a; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
			}
		}else{
			for(int i = 0; i < b; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
		}
		}
		
		System.out.println(list.get(list.size()-c));
		System.out.flush();
		sc.close();

	}
} import java.math.BigDecimal; BigDecimal java.math import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util import java.util.regex.Matcher; Matcher java.util.regex import java.util.regex.Pattern; Pattern java.util.regex public class Main {
	static Scanner sc = new Scanner(System.in);
	
	public static void main (String [] args){
		ArrayList <Integer> list = new ArrayList<Integer>();
//		String [][] boad = new String[4][4];
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());

		int c = Integer.parseInt(sc.next());
//		int d = Integer.parseInt(sc.next());
		int count = 0;
		if(a<b){
			for(int i = 0; i < a; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
			}
		}else{
			for(int i = 0; i < b; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
		}
		}
		
		System.out.println(list.get(list.size()-c));
		System.out.flush();
		sc.close();

	}
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main (String [] args){
		ArrayList <Integer> list = new ArrayList<Integer>();
//		String [][] boad = new String[4][4];
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());

		int c = Integer.parseInt(sc.next());
//		int d = Integer.parseInt(sc.next());
		int count = 0;
		if(a<b){
			for(int i = 0; i < a; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
			}
		}else{
			for(int i = 0; i < b; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
		}
		}
		
		System.out.println(list.get(list.size()-c));
		System.out.flush();
		sc.close();

	} main {
		ArrayList <Integer> list = new ArrayList<Integer>();
//		String [][] boad = new String[4][4];
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());

		int c = Integer.parseInt(sc.next());
//		int d = Integer.parseInt(sc.next());
		int count = 0;
		if(a<b){
			for(int i = 0; i < a; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
			}
		}else{
			for(int i = 0; i < b; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
		}
		}
		
		System.out.println(list.get(list.size()-c));
		System.out.flush();
		sc.close();

	} ArrayList <Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() 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 c = Integer.parseInt(sc.next()); c Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int count = 0; count 0 if(a<b){
			for(int i = 0; i < a; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
			}
		}else{
			for(int i = 0; i < b; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
		}
		} a<b a b {
			for(int i = 0; i < a; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
			}
		} for(int i = 0; i < a; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
			} int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
			} {
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
			} int d = i+1; d i+1 i 1 if(a%d == 0 && b%d == 0){
					list.add(d);
				} a%d == 0 && b%d == 0 a%d == 0 a%d a d 0 b%d == 0 b%d b d 0 {
					list.add(d);
				} list.add(d) list.add list d {
			for(int i = 0; i < b; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
		}
		} for(int i = 0; i < b; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
		} int i = 0; int i = 0; i 0 i < b i b i++ i++ i {
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
		} {
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
		} int d = i+1; d i+1 i 1 if(a%d == 0 && b%d == 0){
					list.add(d);
				} a%d == 0 && b%d == 0 a%d == 0 a%d a d 0 b%d == 0 b%d b d 0 {
					list.add(d);
				} list.add(d) list.add list d System.out.println(list.get(list.size()-c)) System.out.println System.out System System.out list.get(list.size()-c) list.get list list.size()-c list.size() list.size list c System.out.flush() System.out.flush System.out System System.out sc.close() sc.close sc String [] args args public class Main {
	static Scanner sc = new Scanner(System.in);
	
	public static void main (String [] args){
		ArrayList <Integer> list = new ArrayList<Integer>();
//		String [][] boad = new String[4][4];
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());

		int c = Integer.parseInt(sc.next());
//		int d = Integer.parseInt(sc.next());
		int count = 0;
		if(a<b){
			for(int i = 0; i < a; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
			}
		}else{
			for(int i = 0; i < b; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
		}
		}
		
		System.out.println(list.get(list.size()-c));
		System.out.flush();
		sc.close();

	}
} public class Main {
	static Scanner sc = new Scanner(System.in);
	
	public static void main (String [] args){
		ArrayList <Integer> list = new ArrayList<Integer>();
//		String [][] boad = new String[4][4];
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());

		int c = Integer.parseInt(sc.next());
//		int d = Integer.parseInt(sc.next());
		int count = 0;
		if(a<b){
			for(int i = 0; i < a; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
			}
		}else{
			for(int i = 0; i < b; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
		}
		}
		
		System.out.println(list.get(list.size()-c));
		System.out.flush();
		sc.close();

	}
} Main
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class Main {
	static Scanner sc = new Scanner(System.in);
	
	public static void main (String [] args){
		ArrayList <Integer> list = new ArrayList<Integer>();
//		String [][] boad = new String[4][4];
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());

		int c = Integer.parseInt(sc.next());
//		int d = Integer.parseInt(sc.next());
		int count = 0;
		if(a<b){
			for(int i = 0; i < a; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
			}
		}else{
			for(int i = 0; i < b; i++){
				int d = i+1;
				if(a%d == 0 && b%d == 0){
					list.add(d);
				}
		}
		}
		
		System.out.println(list.get(list.size()-c));
		System.out.flush();
		sc.close();

	}
}