import java.util.Scanner;
import java.util.Arrays;

public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int input1 = scan.nextInt();
                int input2 = scan.nextInt();
                int input3 = scan.nextInt();
                int div[] = new int[100];
                Arrays.fill( div, 0 );
                int result1;
                int result2;
                int total = 0;
                int i=0;

                for (i=1; i<=input1; i++) {
                        result1 = input1 % i;
                        result2 = input2 % i;
                        if ( result1 == 0 && result2 == 0 ) {
                                total++;
                                div[total] = i;
                        }
                }

                System.out.println( div[total+1-input3] );
                scan.close();
        }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int input1 = scan.nextInt();
                int input2 = scan.nextInt();
                int input3 = scan.nextInt();
                int div[] = new int[100];
                Arrays.fill( div, 0 );
                int result1;
                int result2;
                int total = 0;
                int i=0;

                for (i=1; i<=input1; i++) {
                        result1 = input1 % i;
                        result2 = input2 % i;
                        if ( result1 == 0 && result2 == 0 ) {
                                total++;
                                div[total] = i;
                        }
                }

                System.out.println( div[total+1-input3] );
                scan.close();
        }
} Main public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int input1 = scan.nextInt();
                int input2 = scan.nextInt();
                int input3 = scan.nextInt();
                int div[] = new int[100];
                Arrays.fill( div, 0 );
                int result1;
                int result2;
                int total = 0;
                int i=0;

                for (i=1; i<=input1; i++) {
                        result1 = input1 % i;
                        result2 = input2 % i;
                        if ( result1 == 0 && result2 == 0 ) {
                                total++;
                                div[total] = i;
                        }
                }

                System.out.println( div[total+1-input3] );
                scan.close();
        } main {
                Scanner scan = new Scanner(System.in);
                int input1 = scan.nextInt();
                int input2 = scan.nextInt();
                int input3 = scan.nextInt();
                int div[] = new int[100];
                Arrays.fill( div, 0 );
                int result1;
                int result2;
                int total = 0;
                int i=0;

                for (i=1; i<=input1; i++) {
                        result1 = input1 % i;
                        result2 = input2 % i;
                        if ( result1 == 0 && result2 == 0 ) {
                                total++;
                                div[total] = i;
                        }
                }

                System.out.println( div[total+1-input3] );
                scan.close();
        } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int input1 = scan.nextInt(); input1 scan.nextInt() scan.nextInt scan int input2 = scan.nextInt(); input2 scan.nextInt() scan.nextInt scan int input3 = scan.nextInt(); input3 scan.nextInt() scan.nextInt scan int div[] = new int[100]; div new int[100] 100 Arrays.fill( div, 0 ) Arrays.fill Arrays div 0 int result1; result1 int result2; result2 int total = 0; total 0 int i=0; i 0 for (i=1; i<=input1; i++) {
                        result1 = input1 % i;
                        result2 = input2 % i;
                        if ( result1 == 0 && result2 == 0 ) {
                                total++;
                                div[total] = i;
                        }
                } i=1; i=1 i 1 i<=input1 i input1 i++ i++ i {
                        result1 = input1 % i;
                        result2 = input2 % i;
                        if ( result1 == 0 && result2 == 0 ) {
                                total++;
                                div[total] = i;
                        }
                } {
                        result1 = input1 % i;
                        result2 = input2 % i;
                        if ( result1 == 0 && result2 == 0 ) {
                                total++;
                                div[total] = i;
                        }
                } result1 = input1 % i result1 input1 % i input1 i result2 = input2 % i result2 input2 % i input2 i if ( result1 == 0 && result2 == 0 ) {
                                total++;
                                div[total] = i;
                        } result1 == 0 && result2 == 0 result1 == 0 result1 0 result2 == 0 result2 0 {
                                total++;
                                div[total] = i;
                        } total++ total div[total] = i div[total] div total i System.out.println( div[total+1-input3] ) System.out.println System.out System System.out div[total+1-input3] div total+1-input3 total+1 total 1 input3 scan.close() scan.close scan String[] args args public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int input1 = scan.nextInt();
                int input2 = scan.nextInt();
                int input3 = scan.nextInt();
                int div[] = new int[100];
                Arrays.fill( div, 0 );
                int result1;
                int result2;
                int total = 0;
                int i=0;

                for (i=1; i<=input1; i++) {
                        result1 = input1 % i;
                        result2 = input2 % i;
                        if ( result1 == 0 && result2 == 0 ) {
                                total++;
                                div[total] = i;
                        }
                }

                System.out.println( div[total+1-input3] );
                scan.close();
        }
} public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int input1 = scan.nextInt();
                int input2 = scan.nextInt();
                int input3 = scan.nextInt();
                int div[] = new int[100];
                Arrays.fill( div, 0 );
                int result1;
                int result2;
                int total = 0;
                int i=0;

                for (i=1; i<=input1; i++) {
                        result1 = input1 % i;
                        result2 = input2 % i;
                        if ( result1 == 0 && result2 == 0 ) {
                                total++;
                                div[total] = i;
                        }
                }

                System.out.println( div[total+1-input3] );
                scan.close();
        }
} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int input1 = scan.nextInt();
                int input2 = scan.nextInt();
                int input3 = scan.nextInt();
                int div[] = new int[100];
                Arrays.fill( div, 0 );
                int result1;
                int result2;
                int total = 0;
                int i=0;

                for (i=1; i<=input1; i++) {
                        result1 = input1 % i;
                        result2 = input2 % i;
                        if ( result1 == 0 && result2 == 0 ) {
                                total++;
                                div[total] = i;
                        }
                }

                System.out.println( div[total+1-input3] );
                scan.close();
        }
}
