import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = Integer.parseInt(scanner.next());
        int y = Integer.parseInt(scanner.next());

        if (x == y) {
            System.out.println(x);
            return;
        }

        if (x < y) {
            int tmp = x;
            x = y;
            y = tmp;
        }

        while (true) {
            int z = x % y;
            if (x % z == 0 && y % z == 0) {
                System.out.println(z);
                break;
            }
            x = y;
            y = z;
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = Integer.parseInt(scanner.next());
        int y = Integer.parseInt(scanner.next());

        if (x == y) {
            System.out.println(x);
            return;
        }

        if (x < y) {
            int tmp = x;
            x = y;
            y = tmp;
        }

        while (true) {
            int z = x % y;
            if (x % z == 0 && y % z == 0) {
                System.out.println(z);
                break;
            }
            x = y;
            y = z;
        }
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = Integer.parseInt(scanner.next());
        int y = Integer.parseInt(scanner.next());

        if (x == y) {
            System.out.println(x);
            return;
        }

        if (x < y) {
            int tmp = x;
            x = y;
            y = tmp;
        }

        while (true) {
            int z = x % y;
            if (x % z == 0 && y % z == 0) {
                System.out.println(z);
                break;
            }
            x = y;
            y = z;
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        int x = Integer.parseInt(scanner.next());
        int y = Integer.parseInt(scanner.next());

        if (x == y) {
            System.out.println(x);
            return;
        }

        if (x < y) {
            int tmp = x;
            x = y;
            y = tmp;
        }

        while (true) {
            int z = x % y;
            if (x % z == 0 && y % z == 0) {
                System.out.println(z);
                break;
            }
            x = y;
            y = z;
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int x = Integer.parseInt(scanner.next()); x Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner int y = Integer.parseInt(scanner.next()); y Integer.parseInt(scanner.next()) Integer.parseInt Integer scanner.next() scanner.next scanner if (x == y) {
            System.out.println(x);
            return;
        } x == y x y {
            System.out.println(x);
            return;
        } System.out.println(x) System.out.println System.out System System.out x return; if (x < y) {
            int tmp = x;
            x = y;
            y = tmp;
        } x < y x y {
            int tmp = x;
            x = y;
            y = tmp;
        } int tmp = x; tmp x x = y x y y = tmp y tmp while (true) {
            int z = x % y;
            if (x % z == 0 && y % z == 0) {
                System.out.println(z);
                break;
            }
            x = y;
            y = z;
        } true {
            int z = x % y;
            if (x % z == 0 && y % z == 0) {
                System.out.println(z);
                break;
            }
            x = y;
            y = z;
        } int z = x % y; z x % y x y if (x % z == 0 && y % z == 0) {
                System.out.println(z);
                break;
            } x % z == 0 && y % z == 0 x % z == 0 x % z x z 0 y % z == 0 y % z y z 0 {
                System.out.println(z);
                break;
            } System.out.println(z) System.out.println System.out System System.out z break; x = y x y y = z y z String[] args args public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = Integer.parseInt(scanner.next());
        int y = Integer.parseInt(scanner.next());

        if (x == y) {
            System.out.println(x);
            return;
        }

        if (x < y) {
            int tmp = x;
            x = y;
            y = tmp;
        }

        while (true) {
            int z = x % y;
            if (x % z == 0 && y % z == 0) {
                System.out.println(z);
                break;
            }
            x = y;
            y = z;
        }
    }
} public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = Integer.parseInt(scanner.next());
        int y = Integer.parseInt(scanner.next());

        if (x == y) {
            System.out.println(x);
            return;
        }

        if (x < y) {
            int tmp = x;
            x = y;
            y = tmp;
        }

        while (true) {
            int z = x % y;
            if (x % z == 0 && y % z == 0) {
                System.out.println(z);
                break;
            }
            x = y;
            y = z;
        }
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = Integer.parseInt(scanner.next());
        int y = Integer.parseInt(scanner.next());

        if (x == y) {
            System.out.println(x);
            return;
        }

        if (x < y) {
            int tmp = x;
            x = y;
            y = tmp;
        }

        while (true) {
            int z = x % y;
            if (x % z == 0 && y % z == 0) {
                System.out.println(z);
                break;
            }
            x = y;
            y = z;
        }
    }
}