import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");
        int a = Integer.parseInt(input[0]);
        int b = Integer.parseInt(input[1]);
        int gcd = 1;
        if (a > b) {
            int temp = b;
            b = a;
            a = temp;
        }
        int i = 1;
        while (i > 0) {
            if (a%(a/i) == 0 && b%(a/i) == 0) {
                System.out.println(a/i);
                return;
            } else {
                i++;
            }
        }

        
    }
} import java.io.*; io.* java class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");
        int a = Integer.parseInt(input[0]);
        int b = Integer.parseInt(input[1]);
        int gcd = 1;
        if (a > b) {
            int temp = b;
            b = a;
            a = temp;
        }
        int i = 1;
        while (i > 0) {
            if (a%(a/i) == 0 && b%(a/i) == 0) {
                System.out.println(a/i);
                return;
            } else {
                i++;
            }
        }

        
    }
} Main public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");
        int a = Integer.parseInt(input[0]);
        int b = Integer.parseInt(input[1]);
        int gcd = 1;
        if (a > b) {
            int temp = b;
            b = a;
            a = temp;
        }
        int i = 1;
        while (i > 0) {
            if (a%(a/i) == 0 && b%(a/i) == 0) {
                System.out.println(a/i);
                return;
            } else {
                i++;
            }
        }

        
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");
        int a = Integer.parseInt(input[0]);
        int b = Integer.parseInt(input[1]);
        int gcd = 1;
        if (a > b) {
            int temp = b;
            b = a;
            a = temp;
        }
        int i = 1;
        while (i > 0) {
            if (a%(a/i) == 0 && b%(a/i) == 0) {
                System.out.println(a/i);
                return;
            } else {
                i++;
            }
        }

        
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] input = br.readLine().split(" "); input br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " 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 gcd = 1; gcd 1 if (a > b) {
            int temp = b;
            b = a;
            a = temp;
        } a > b a b {
            int temp = b;
            b = a;
            a = temp;
        } int temp = b; temp b b = a b a a = temp a temp int i = 1; i 1 while (i > 0) {
            if (a%(a/i) == 0 && b%(a/i) == 0) {
                System.out.println(a/i);
                return;
            } else {
                i++;
            }
        } i > 0 i 0 {
            if (a%(a/i) == 0 && b%(a/i) == 0) {
                System.out.println(a/i);
                return;
            } else {
                i++;
            }
        } if (a%(a/i) == 0 && b%(a/i) == 0) {
                System.out.println(a/i);
                return;
            } else {
                i++;
            } a%(a/i) == 0 && b%(a/i) == 0 a%(a/i) == 0 a%(a/i) a (a/i) a i 0 b%(a/i) == 0 b%(a/i) b (a/i) a i 0 {
                System.out.println(a/i);
                return;
            } System.out.println(a/i) System.out.println System.out System System.out a/i a i return; {
                i++;
            } i++ i String[] args args
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] input = br.readLine().split(" ");
        int a = Integer.parseInt(input[0]);
        int b = Integer.parseInt(input[1]);
        int gcd = 1;
        if (a > b) {
            int temp = b;
            b = a;
            a = temp;
        }
        int i = 1;
        while (i > 0) {
            if (a%(a/i) == 0 && b%(a/i) == 0) {
                System.out.println(a/i);
                return;
            } else {
                i++;
            }
        }

        
    }
}