import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main{
	public static void main(String[] args){
		InputStreamReader ir = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(ir);

		String str = null;
		try{
			str = br.readLine();
		}catch(IOException ex){
			ex.printStackTrace();
		}

		String[] input = str.split(" ");
		int a = Integer.parseInt(input[0]);
		int b = Integer.parseInt(input[1]);
		int k = Integer.parseInt(input[2]);

		List<Integer> res = new ArrayList<>();
		for(int i = 1; i <= 100; i++){
			if(a % i == 0 && b % i == 0){
				res.add(i);
			}
		}
		System.out.println(res.get(res.size() - k));
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util public class Main{
	public static void main(String[] args){
		InputStreamReader ir = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(ir);

		String str = null;
		try{
			str = br.readLine();
		}catch(IOException ex){
			ex.printStackTrace();
		}

		String[] input = str.split(" ");
		int a = Integer.parseInt(input[0]);
		int b = Integer.parseInt(input[1]);
		int k = Integer.parseInt(input[2]);

		List<Integer> res = new ArrayList<>();
		for(int i = 1; i <= 100; i++){
			if(a % i == 0 && b % i == 0){
				res.add(i);
			}
		}
		System.out.println(res.get(res.size() - k));
	}
} Main public static void main(String[] args){
		InputStreamReader ir = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(ir);

		String str = null;
		try{
			str = br.readLine();
		}catch(IOException ex){
			ex.printStackTrace();
		}

		String[] input = str.split(" ");
		int a = Integer.parseInt(input[0]);
		int b = Integer.parseInt(input[1]);
		int k = Integer.parseInt(input[2]);

		List<Integer> res = new ArrayList<>();
		for(int i = 1; i <= 100; i++){
			if(a % i == 0 && b % i == 0){
				res.add(i);
			}
		}
		System.out.println(res.get(res.size() - k));
	} main {
		InputStreamReader ir = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(ir);

		String str = null;
		try{
			str = br.readLine();
		}catch(IOException ex){
			ex.printStackTrace();
		}

		String[] input = str.split(" ");
		int a = Integer.parseInt(input[0]);
		int b = Integer.parseInt(input[1]);
		int k = Integer.parseInt(input[2]);

		List<Integer> res = new ArrayList<>();
		for(int i = 1; i <= 100; i++){
			if(a % i == 0 && b % i == 0){
				res.add(i);
			}
		}
		System.out.println(res.get(res.size() - k));
	} InputStreamReader ir = new InputStreamReader(System.in); ir new InputStreamReader(System.in) BufferedReader br = new BufferedReader(ir); br new BufferedReader(ir) String str = null; str null try{
			str = br.readLine();
		}catch(IOException ex){
			ex.printStackTrace();
		} catch(IOException ex){
			ex.printStackTrace();
		} IOException ex {
			ex.printStackTrace();
		} ex.printStackTrace() ex.printStackTrace ex {
			str = br.readLine();
		} str = br.readLine() str br.readLine() br.readLine br String[] input = str.split(" "); input str.split(" ") str.split str " " int a = Integer.parseInt(input[0]); a Integer.parseInt(input[0]) Integer.parseInt Integer input[0] input 0 int b = Integer.parseInt(input[1]); b Integer.parseInt(input[1]) Integer.parseInt Integer input[1] input 1 int k = Integer.parseInt(input[2]); k Integer.parseInt(input[2]) Integer.parseInt Integer input[2] input 2 List<Integer> res = new ArrayList<>(); res new ArrayList<>() for(int i = 1; i <= 100; i++){
			if(a % i == 0 && b % i == 0){
				res.add(i);
			}
		} int i = 1; int i = 1; i 1 i <= 100 i 100 i++ i++ i {
			if(a % i == 0 && b % i == 0){
				res.add(i);
			}
		} {
			if(a % i == 0 && b % i == 0){
				res.add(i);
			}
		} if(a % i == 0 && b % i == 0){
				res.add(i);
			} a % i == 0 && b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 {
				res.add(i);
			} res.add(i) res.add res i System.out.println(res.get(res.size() - k)) System.out.println System.out System System.out res.get(res.size() - k) res.get res res.size() - k res.size() res.size res k String[] args args public class Main{
	public static void main(String[] args){
		InputStreamReader ir = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(ir);

		String str = null;
		try{
			str = br.readLine();
		}catch(IOException ex){
			ex.printStackTrace();
		}

		String[] input = str.split(" ");
		int a = Integer.parseInt(input[0]);
		int b = Integer.parseInt(input[1]);
		int k = Integer.parseInt(input[2]);

		List<Integer> res = new ArrayList<>();
		for(int i = 1; i <= 100; i++){
			if(a % i == 0 && b % i == 0){
				res.add(i);
			}
		}
		System.out.println(res.get(res.size() - k));
	}
} public class Main{
	public static void main(String[] args){
		InputStreamReader ir = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(ir);

		String str = null;
		try{
			str = br.readLine();
		}catch(IOException ex){
			ex.printStackTrace();
		}

		String[] input = str.split(" ");
		int a = Integer.parseInt(input[0]);
		int b = Integer.parseInt(input[1]);
		int k = Integer.parseInt(input[2]);

		List<Integer> res = new ArrayList<>();
		for(int i = 1; i <= 100; i++){
			if(a % i == 0 && b % i == 0){
				res.add(i);
			}
		}
		System.out.println(res.get(res.size() - k));
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main{
	public static void main(String[] args){
		InputStreamReader ir = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(ir);

		String str = null;
		try{
			str = br.readLine();
		}catch(IOException ex){
			ex.printStackTrace();
		}

		String[] input = str.split(" ");
		int a = Integer.parseInt(input[0]);
		int b = Integer.parseInt(input[1]);
		int k = Integer.parseInt(input[2]);

		List<Integer> res = new ArrayList<>();
		for(int i = 1; i <= 100; i++){
			if(a % i == 0 && b % i == 0){
				res.add(i);
			}
		}
		System.out.println(res.get(res.size() - k));
	}
}
