import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {

	/* --------------------------------------------------------------------
	   main
	 * -------------------------------------------------------------------- */
	public static void main(String args[]) throws Exception {

		// ----- input -----
		Input input = new Input(System.in);
		final Data l = input.readLine();
		input.close();

		// ----- main -----
		int cnt = 0;
		for(int i = Math.min(l.col[0], l.col[1]); i > 0; i--) {
			if(l.col[0] % i == 0 && l.col[1] % i == 0) {
				if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				}
			}
		}
	}

	/* --------------------------------------------------------------------
	 * inupt class
	 * -------------------------------------------------------------------- */
	static class Input {

		public BufferedReader input;

		public Input(InputStream inStream) {
			input = new BufferedReader(new InputStreamReader(inStream));
		}

		public void close() throws Exception {
			input.close();
		}

		public Data readLine() throws Exception {
			return new Data(input.readLine().split(" "));
		}
	}
	/* --------------------------------------------------------------------
	 * data class
	 * -------------------------------------------------------------------- */
	static class Data{
		public int[] col;
		public Data(String[] values) {
			col = new int[values.length];
			for(int i=0; i < values.length; i++) {
				col[i] = Integer.parseInt(values[i]);
			}
		}
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	/* --------------------------------------------------------------------
	   main
	 * -------------------------------------------------------------------- */
	public static void main(String args[]) throws Exception {

		// ----- input -----
		Input input = new Input(System.in);
		final Data l = input.readLine();
		input.close();

		// ----- main -----
		int cnt = 0;
		for(int i = Math.min(l.col[0], l.col[1]); i > 0; i--) {
			if(l.col[0] % i == 0 && l.col[1] % i == 0) {
				if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				}
			}
		}
	}

	/* --------------------------------------------------------------------
	 * inupt class
	 * -------------------------------------------------------------------- */
	static class Input {

		public BufferedReader input;

		public Input(InputStream inStream) {
			input = new BufferedReader(new InputStreamReader(inStream));
		}

		public void close() throws Exception {
			input.close();
		}

		public Data readLine() throws Exception {
			return new Data(input.readLine().split(" "));
		}
	}
	/* --------------------------------------------------------------------
	 * data class
	 * -------------------------------------------------------------------- */
	static class Data{
		public int[] col;
		public Data(String[] values) {
			col = new int[values.length];
			for(int i=0; i < values.length; i++) {
				col[i] = Integer.parseInt(values[i]);
			}
		}
	}

} Main /* --------------------------------------------------------------------
	   main
	 * -------------------------------------------------------------------- */
	public static void main(String args[]) throws Exception {

		// ----- input -----
		Input input = new Input(System.in);
		final Data l = input.readLine();
		input.close();

		// ----- main -----
		int cnt = 0;
		for(int i = Math.min(l.col[0], l.col[1]); i > 0; i--) {
			if(l.col[0] % i == 0 && l.col[1] % i == 0) {
				if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				}
			}
		}
	} main {

		// ----- input -----
		Input input = new Input(System.in);
		final Data l = input.readLine();
		input.close();

		// ----- main -----
		int cnt = 0;
		for(int i = Math.min(l.col[0], l.col[1]); i > 0; i--) {
			if(l.col[0] % i == 0 && l.col[1] % i == 0) {
				if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				}
			}
		}
	} Input input = new Input(System.in); input new Input(System.in) final Data l = input.readLine(); l input.readLine() input.readLine input input.close() input.close input int cnt = 0; cnt 0 for(int i = Math.min(l.col[0], l.col[1]); i > 0; i--) {
			if(l.col[0] % i == 0 && l.col[1] % i == 0) {
				if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				}
			}
		} int i = Math.min(l.col[0], l.col[1]); int i = Math.min(l.col[0], l.col[1]); i Math.min(l.col[0], l.col[1]) Math.min Math l.col[0] l.col l l.col 0 l.col[1] l.col l l.col 1 i > 0 i 0 i-- i-- i {
			if(l.col[0] % i == 0 && l.col[1] % i == 0) {
				if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				}
			}
		} {
			if(l.col[0] % i == 0 && l.col[1] % i == 0) {
				if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				}
			}
		} if(l.col[0] % i == 0 && l.col[1] % i == 0) {
				if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				}
			} l.col[0] % i == 0 && l.col[1] % i == 0 l.col[0] % i == 0 l.col[0] % i l.col[0] l.col l l.col 0 i 0 l.col[1] % i == 0 l.col[1] % i l.col[1] l.col l l.col 1 i 0 {
				if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				}
			} if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				} ++cnt == l.col[2] ++cnt cnt l.col[2] l.col l l.col 2 {
					System.out.println(i);
					return;
				} System.out.println(i) System.out.println System.out System System.out i return; String args[] args static class Input {

		public BufferedReader input;

		public Input(InputStream inStream) {
			input = new BufferedReader(new InputStreamReader(inStream));
		}

		public void close() throws Exception {
			input.close();
		}

		public Data readLine() throws Exception {
			return new Data(input.readLine().split(" "));
		}
	} Input public BufferedReader input; input public Input(InputStream inStream) {
			input = new BufferedReader(new InputStreamReader(inStream));
		} Input {
			input = new BufferedReader(new InputStreamReader(inStream));
		} input = new BufferedReader(new InputStreamReader(inStream)) input new BufferedReader(new InputStreamReader(inStream)) InputStream inStream inStream public void close() throws Exception {
			input.close();
		} close {
			input.close();
		} input.close() input.close input public Data readLine() throws Exception {
			return new Data(input.readLine().split(" "));
		} readLine {
			return new Data(input.readLine().split(" "));
		} return new Data(input.readLine().split(" ")); new Data(input.readLine().split(" ")) static class Data{
		public int[] col;
		public Data(String[] values) {
			col = new int[values.length];
			for(int i=0; i < values.length; i++) {
				col[i] = Integer.parseInt(values[i]);
			}
		}
	} Data public int[] col; col public Data(String[] values) {
			col = new int[values.length];
			for(int i=0; i < values.length; i++) {
				col[i] = Integer.parseInt(values[i]);
			}
		} Data {
			col = new int[values.length];
			for(int i=0; i < values.length; i++) {
				col[i] = Integer.parseInt(values[i]);
			}
		} col = new int[values.length] col new int[values.length] values.length values values.length for(int i=0; i < values.length; i++) {
				col[i] = Integer.parseInt(values[i]);
			} int i=0; int i=0; i 0 i < values.length i values.length values values.length i++ i++ i {
				col[i] = Integer.parseInt(values[i]);
			} {
				col[i] = Integer.parseInt(values[i]);
			} col[i] = Integer.parseInt(values[i]) col[i] col i Integer.parseInt(values[i]) Integer.parseInt Integer values[i] values i String[] values values public class Main {

	/* --------------------------------------------------------------------
	   main
	 * -------------------------------------------------------------------- */
	public static void main(String args[]) throws Exception {

		// ----- input -----
		Input input = new Input(System.in);
		final Data l = input.readLine();
		input.close();

		// ----- main -----
		int cnt = 0;
		for(int i = Math.min(l.col[0], l.col[1]); i > 0; i--) {
			if(l.col[0] % i == 0 && l.col[1] % i == 0) {
				if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				}
			}
		}
	}

	/* --------------------------------------------------------------------
	 * inupt class
	 * -------------------------------------------------------------------- */
	static class Input {

		public BufferedReader input;

		public Input(InputStream inStream) {
			input = new BufferedReader(new InputStreamReader(inStream));
		}

		public void close() throws Exception {
			input.close();
		}

		public Data readLine() throws Exception {
			return new Data(input.readLine().split(" "));
		}
	}
	/* --------------------------------------------------------------------
	 * data class
	 * -------------------------------------------------------------------- */
	static class Data{
		public int[] col;
		public Data(String[] values) {
			col = new int[values.length];
			for(int i=0; i < values.length; i++) {
				col[i] = Integer.parseInt(values[i]);
			}
		}
	}

} public class Main {

	/* --------------------------------------------------------------------
	   main
	 * -------------------------------------------------------------------- */
	public static void main(String args[]) throws Exception {

		// ----- input -----
		Input input = new Input(System.in);
		final Data l = input.readLine();
		input.close();

		// ----- main -----
		int cnt = 0;
		for(int i = Math.min(l.col[0], l.col[1]); i > 0; i--) {
			if(l.col[0] % i == 0 && l.col[1] % i == 0) {
				if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				}
			}
		}
	}

	/* --------------------------------------------------------------------
	 * inupt class
	 * -------------------------------------------------------------------- */
	static class Input {

		public BufferedReader input;

		public Input(InputStream inStream) {
			input = new BufferedReader(new InputStreamReader(inStream));
		}

		public void close() throws Exception {
			input.close();
		}

		public Data readLine() throws Exception {
			return new Data(input.readLine().split(" "));
		}
	}
	/* --------------------------------------------------------------------
	 * data class
	 * -------------------------------------------------------------------- */
	static class Data{
		public int[] col;
		public Data(String[] values) {
			col = new int[values.length];
			for(int i=0; i < values.length; i++) {
				col[i] = Integer.parseInt(values[i]);
			}
		}
	}

} Main
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {

	/* --------------------------------------------------------------------
	   main
	 * -------------------------------------------------------------------- */
	public static void main(String args[]) throws Exception {

		// ----- input -----
		Input input = new Input(System.in);
		final Data l = input.readLine();
		input.close();

		// ----- main -----
		int cnt = 0;
		for(int i = Math.min(l.col[0], l.col[1]); i > 0; i--) {
			if(l.col[0] % i == 0 && l.col[1] % i == 0) {
				if(++cnt == l.col[2]) {
					System.out.println(i);
					return;
				}
			}
		}
	}

	/* --------------------------------------------------------------------
	 * inupt class
	 * -------------------------------------------------------------------- */
	static class Input {

		public BufferedReader input;

		public Input(InputStream inStream) {
			input = new BufferedReader(new InputStreamReader(inStream));
		}

		public void close() throws Exception {
			input.close();
		}

		public Data readLine() throws Exception {
			return new Data(input.readLine().split(" "));
		}
	}
	/* --------------------------------------------------------------------
	 * data class
	 * -------------------------------------------------------------------- */
	static class Data{
		public int[] col;
		public Data(String[] values) {
			col = new int[values.length];
			for(int i=0; i < values.length; i++) {
				col[i] = Integer.parseInt(values[i]);
			}
		}
	}

}