import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    //final List<Integer> list = new ArrayList<>();
    //final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();
    int count = 0;
    int high = 0;
    if(a >= b){
        high = a;
    }else{
        high = b;
    }

    for(int i = high; i > 0 ; i--){
        if(a % i == 0 && b % i == 0){
            count++;
        }
        if(k == count){
            System.out.println(i);
            System.exit(0);
        }
    }

    




    







}
} import java.io.BufferedReader; BufferedReader java.io import java.io.*; io.* java import java.util.*; util.* java import java.util.ArrayList; ArrayList java.util import java.util.Iterator; Iterator java.util import java.util.List; List java.util import java.util.Collections; Collections java.util import java.util.Arrays; Arrays java.util public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    //final List<Integer> list = new ArrayList<>();
    //final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();
    int count = 0;
    int high = 0;
    if(a >= b){
        high = a;
    }else{
        high = b;
    }

    for(int i = high; i > 0 ; i--){
        if(a % i == 0 && b % i == 0){
            count++;
        }
        if(k == count){
            System.out.println(i);
            System.exit(0);
        }
    }

    




    







}
} Main public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    //final List<Integer> list = new ArrayList<>();
    //final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();
    int count = 0;
    int high = 0;
    if(a >= b){
        high = a;
    }else{
        high = b;
    }

    for(int i = high; i > 0 ; i--){
        if(a % i == 0 && b % i == 0){
            count++;
        }
        if(k == count){
            System.out.println(i);
            System.exit(0);
        }
    }

    




    







} main {
    
    final Scanner sc = new Scanner(System.in);
    //final List<Integer> list = new ArrayList<>();
    //final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();
    int count = 0;
    int high = 0;
    if(a >= b){
        high = a;
    }else{
        high = b;
    }

    for(int i = high; i > 0 ; i--){
        if(a % i == 0 && b % i == 0){
            count++;
        }
        if(k == count){
            System.out.println(i);
            System.exit(0);
        }
    }

    




    







} final Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int k = sc.nextInt(); k sc.nextInt() sc.nextInt sc int count = 0; count 0 int high = 0; high 0 if(a >= b){
        high = a;
    }else{
        high = b;
    } a >= b a b {
        high = a;
    } high = a high a {
        high = b;
    } high = b high b for(int i = high; i > 0 ; i--){
        if(a % i == 0 && b % i == 0){
            count++;
        }
        if(k == count){
            System.out.println(i);
            System.exit(0);
        }
    } int i = high; int i = high; i high i > 0 i 0 i-- i-- i {
        if(a % i == 0 && b % i == 0){
            count++;
        }
        if(k == count){
            System.out.println(i);
            System.exit(0);
        }
    } {
        if(a % i == 0 && b % i == 0){
            count++;
        }
        if(k == count){
            System.out.println(i);
            System.exit(0);
        }
    } if(a % i == 0 && b % i == 0){
            count++;
        } a % i == 0 && b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 {
            count++;
        } count++ count if(k == count){
            System.out.println(i);
            System.exit(0);
        } k == count k count {
            System.out.println(i);
            System.exit(0);
        } System.out.println(i) System.out.println System.out System System.out i System.exit(0) System.exit System 0 final String[] args args public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    //final List<Integer> list = new ArrayList<>();
    //final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();
    int count = 0;
    int high = 0;
    if(a >= b){
        high = a;
    }else{
        high = b;
    }

    for(int i = high; i > 0 ; i--){
        if(a % i == 0 && b % i == 0){
            count++;
        }
        if(k == count){
            System.out.println(i);
            System.exit(0);
        }
    }

    




    







}
} public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    //final List<Integer> list = new ArrayList<>();
    //final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();
    int count = 0;
    int high = 0;
    if(a >= b){
        high = a;
    }else{
        high = b;
    }

    for(int i = high; i > 0 ; i--){
        if(a % i == 0 && b % i == 0){
            count++;
        }
        if(k == count){
            System.out.println(i);
            System.exit(0);
        }
    }

    




    







}
} Main
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    final Scanner sc = new Scanner(System.in);
    //final List<Integer> list = new ArrayList<>();
    //final List<Integer> list2 = new ArrayList<>();
    //final List<Long> list3 = new ArrayList<>();

    int a = sc.nextInt();
    int b = sc.nextInt();
    int k = sc.nextInt();
    int count = 0;
    int high = 0;
    if(a >= b){
        high = a;
    }else{
        high = b;
    }

    for(int i = high; i > 0 ; i--){
        if(a % i == 0 && b % i == 0){
            count++;
        }
        if(k == count){
            System.out.println(i);
            System.exit(0);
        }
    }

    




    







}
}