import java.util.*;

public class Main {
  public static void main(String[]args) {
    Scanner s = new Scanner(System.in);
    int a = s.nextInt(), b = s.nextInt(), c = s.nextInt();
    List<Integer> list = new ArrayList<>();
    for (int i = 1; i <= Math.min(a, b) ; ++i) {
      if (a % i == 0 && b % i == 0) {
	 list.add(i);
      }
    }
    System.out.println(list.get(list.size() - c));
  }  
} import java.util.*; util.* java public class Main {
  public static void main(String[]args) {
    Scanner s = new Scanner(System.in);
    int a = s.nextInt(), b = s.nextInt(), c = s.nextInt();
    List<Integer> list = new ArrayList<>();
    for (int i = 1; i <= Math.min(a, b) ; ++i) {
      if (a % i == 0 && b % i == 0) {
	 list.add(i);
      }
    }
    System.out.println(list.get(list.size() - c));
  }  
} Main public static void main(String[]args) {
    Scanner s = new Scanner(System.in);
    int a = s.nextInt(), b = s.nextInt(), c = s.nextInt();
    List<Integer> list = new ArrayList<>();
    for (int i = 1; i <= Math.min(a, b) ; ++i) {
      if (a % i == 0 && b % i == 0) {
	 list.add(i);
      }
    }
    System.out.println(list.get(list.size() - c));
  } main {
    Scanner s = new Scanner(System.in);
    int a = s.nextInt(), b = s.nextInt(), c = s.nextInt();
    List<Integer> list = new ArrayList<>();
    for (int i = 1; i <= Math.min(a, b) ; ++i) {
      if (a % i == 0 && b % i == 0) {
	 list.add(i);
      }
    }
    System.out.println(list.get(list.size() - c));
  } Scanner s = new Scanner(System.in); s new Scanner(System.in) int a = s.nextInt() a s.nextInt() s.nextInt s b = s.nextInt() b s.nextInt() s.nextInt s c = s.nextInt(); c s.nextInt() s.nextInt s List<Integer> list = new ArrayList<>(); list new ArrayList<>() for (int i = 1; i <= Math.min(a, b) ; ++i) {
      if (a % i == 0 && b % i == 0) {
	 list.add(i);
      }
    } int i = 1; int i = 1; i 1 i <= Math.min(a, b) i Math.min(a, b) Math.min Math a b ++i ++i i {
      if (a % i == 0 && b % i == 0) {
	 list.add(i);
      }
    } {
      if (a % i == 0 && b % i == 0) {
	 list.add(i);
      }
    } if (a % i == 0 && b % i == 0) {
	 list.add(i);
      } a % i == 0 && b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 {
	 list.add(i);
      } list.add(i) list.add list i 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 String[]args args public class Main {
  public static void main(String[]args) {
    Scanner s = new Scanner(System.in);
    int a = s.nextInt(), b = s.nextInt(), c = s.nextInt();
    List<Integer> list = new ArrayList<>();
    for (int i = 1; i <= Math.min(a, b) ; ++i) {
      if (a % i == 0 && b % i == 0) {
	 list.add(i);
      }
    }
    System.out.println(list.get(list.size() - c));
  }  
} public class Main {
  public static void main(String[]args) {
    Scanner s = new Scanner(System.in);
    int a = s.nextInt(), b = s.nextInt(), c = s.nextInt();
    List<Integer> list = new ArrayList<>();
    for (int i = 1; i <= Math.min(a, b) ; ++i) {
      if (a % i == 0 && b % i == 0) {
	 list.add(i);
      }
    }
    System.out.println(list.get(list.size() - c));
  }  
} Main
import java.util.*;

public class Main {
  public static void main(String[]args) {
    Scanner s = new Scanner(System.in);
    int a = s.nextInt(), b = s.nextInt(), c = s.nextInt();
    List<Integer> list = new ArrayList<>();
    for (int i = 1; i <= Math.min(a, b) ; ++i) {
      if (a % i == 0 && b % i == 0) {
	 list.add(i);
      }
    }
    System.out.println(list.get(list.size() - c));
  }  
}
