import java.io.*;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
 
        String line1 = scanner.next();
        String line3 = scanner.next();

        int a = Integer.parseInt(line1);
        int b = Integer.parseInt(line3);
        int c,num;
        if(a == b){
            c = a;
        }else if(a >= b){
            c = a % b;
        }else{
            c = b % a;
            b = a;
        }
        for(int i = c;i >= 1;i--){
            if(b % i == 0 && c % i == 0){
                System.out.println(i);
                break;
            }
        }

    }
} import java.io.*; io.* java import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
 
        String line1 = scanner.next();
        String line3 = scanner.next();

        int a = Integer.parseInt(line1);
        int b = Integer.parseInt(line3);
        int c,num;
        if(a == b){
            c = a;
        }else if(a >= b){
            c = a % b;
        }else{
            c = b % a;
            b = a;
        }
        for(int i = c;i >= 1;i--){
            if(b % i == 0 && c % i == 0){
                System.out.println(i);
                break;
            }
        }

    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
 
        String line1 = scanner.next();
        String line3 = scanner.next();

        int a = Integer.parseInt(line1);
        int b = Integer.parseInt(line3);
        int c,num;
        if(a == b){
            c = a;
        }else if(a >= b){
            c = a % b;
        }else{
            c = b % a;
            b = a;
        }
        for(int i = c;i >= 1;i--){
            if(b % i == 0 && c % i == 0){
                System.out.println(i);
                break;
            }
        }

    } main {
        Scanner scanner = new Scanner(System.in);
 
        String line1 = scanner.next();
        String line3 = scanner.next();

        int a = Integer.parseInt(line1);
        int b = Integer.parseInt(line3);
        int c,num;
        if(a == b){
            c = a;
        }else if(a >= b){
            c = a % b;
        }else{
            c = b % a;
            b = a;
        }
        for(int i = c;i >= 1;i--){
            if(b % i == 0 && c % i == 0){
                System.out.println(i);
                break;
            }
        }

    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String line1 = scanner.next(); line1 scanner.next() scanner.next scanner String line3 = scanner.next(); line3 scanner.next() scanner.next scanner int a = Integer.parseInt(line1); a Integer.parseInt(line1) Integer.parseInt Integer line1 int b = Integer.parseInt(line3); b Integer.parseInt(line3) Integer.parseInt Integer line3 int c c num; num if(a == b){
            c = a;
        }else if(a >= b){
            c = a % b;
        }else{
            c = b % a;
            b = a;
        } a == b a b {
            c = a;
        } c = a c a if(a >= b){
            c = a % b;
        }else{
            c = b % a;
            b = a;
        } a >= b a b {
            c = a % b;
        } c = a % b c a % b a b {
            c = b % a;
            b = a;
        } c = b % a c b % a b a b = a b a for(int i = c;i >= 1;i--){
            if(b % i == 0 && c % i == 0){
                System.out.println(i);
                break;
            }
        } int i = c; int i = c; i c i >= 1 i 1 i-- i-- i {
            if(b % i == 0 && c % i == 0){
                System.out.println(i);
                break;
            }
        } {
            if(b % i == 0 && c % i == 0){
                System.out.println(i);
                break;
            }
        } if(b % i == 0 && c % i == 0){
                System.out.println(i);
                break;
            } b % i == 0 && c % i == 0 b % i == 0 b % i b i 0 c % i == 0 c % i c i 0 {
                System.out.println(i);
                break;
            } System.out.println(i) System.out.println System.out System System.out i break; String[] args args public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
 
        String line1 = scanner.next();
        String line3 = scanner.next();

        int a = Integer.parseInt(line1);
        int b = Integer.parseInt(line3);
        int c,num;
        if(a == b){
            c = a;
        }else if(a >= b){
            c = a % b;
        }else{
            c = b % a;
            b = a;
        }
        for(int i = c;i >= 1;i--){
            if(b % i == 0 && c % i == 0){
                System.out.println(i);
                break;
            }
        }

    }
} public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
 
        String line1 = scanner.next();
        String line3 = scanner.next();

        int a = Integer.parseInt(line1);
        int b = Integer.parseInt(line3);
        int c,num;
        if(a == b){
            c = a;
        }else if(a >= b){
            c = a % b;
        }else{
            c = b % a;
            b = a;
        }
        for(int i = c;i >= 1;i--){
            if(b % i == 0 && c % i == 0){
                System.out.println(i);
                break;
            }
        }

    }
} Main
import java.io.*;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
 
        String line1 = scanner.next();
        String line3 = scanner.next();

        int a = Integer.parseInt(line1);
        int b = Integer.parseInt(line3);
        int c,num;
        if(a == b){
            c = a;
        }else if(a >= b){
            c = a % b;
        }else{
            c = b % a;
            b = a;
        }
        for(int i = c;i >= 1;i--){
            if(b % i == 0 && c % i == 0){
                System.out.println(i);
                break;
            }
        }

    }
}
