import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            String[] x=line.split(" ");
            int a=Integer.parseInt(x[0]);
            int b=Integer.parseInt(x[1]);
            int store=0;
            for(int i=1;i<Integer.min(a, b)+1;i++){
            	if(a%i==0&&b%i==0){
            		store=i;
            	}
            }
            System.out.println(store);
        }
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            String[] x=line.split(" ");
            int a=Integer.parseInt(x[0]);
            int b=Integer.parseInt(x[1]);
            int store=0;
            for(int i=1;i<Integer.min(a, b)+1;i++){
            	if(a%i==0&&b%i==0){
            		store=i;
            	}
            }
            System.out.println(store);
        }
	}

} Main public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            String[] x=line.split(" ");
            int a=Integer.parseInt(x[0]);
            int b=Integer.parseInt(x[1]);
            int store=0;
            for(int i=1;i<Integer.min(a, b)+1;i++){
            	if(a%i==0&&b%i==0){
            		store=i;
            	}
            }
            System.out.println(store);
        }
	} main {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            String[] x=line.split(" ");
            int a=Integer.parseInt(x[0]);
            int b=Integer.parseInt(x[1]);
            int store=0;
            for(int i=1;i<Integer.min(a, b)+1;i++){
            	if(a%i==0&&b%i==0){
            		store=i;
            	}
            }
            System.out.println(store);
        }
	} try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            String[] x=line.split(" ");
            int a=Integer.parseInt(x[0]);
            int b=Integer.parseInt(x[1]);
            int store=0;
            for(int i=1;i<Integer.min(a, b)+1;i++){
            	if(a%i==0&&b%i==0){
            		store=i;
            	}
            }
            System.out.println(store);
        } {
            String line;
            line=br.readLine();
            String[] x=line.split(" ");
            int a=Integer.parseInt(x[0]);
            int b=Integer.parseInt(x[1]);
            int store=0;
            for(int i=1;i<Integer.min(a, b)+1;i++){
            	if(a%i==0&&b%i==0){
            		store=i;
            	}
            }
            System.out.println(store);
        } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) String line; line line=br.readLine() line br.readLine() br.readLine br String[] x=line.split(" "); x line.split(" ") line.split line " " int a=Integer.parseInt(x[0]); a Integer.parseInt(x[0]) Integer.parseInt Integer x[0] x 0 int b=Integer.parseInt(x[1]); b Integer.parseInt(x[1]) Integer.parseInt Integer x[1] x 1 int store=0; store 0 for(int i=1;i<Integer.min(a, b)+1;i++){
            	if(a%i==0&&b%i==0){
            		store=i;
            	}
            } int i=1; int i=1; i 1 i<Integer.min(a, b)+1 i Integer.min(a, b)+1 Integer.min(a, b) Integer.min Integer a b 1 i++ i++ i {
            	if(a%i==0&&b%i==0){
            		store=i;
            	}
            } {
            	if(a%i==0&&b%i==0){
            		store=i;
            	}
            } if(a%i==0&&b%i==0){
            		store=i;
            	} a%i==0&&b%i==0 a%i==0 a%i a i 0 b%i==0 b%i b i 0 {
            		store=i;
            	} store=i store i System.out.println(store) System.out.println System.out System System.out store String[] args args public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            String[] x=line.split(" ");
            int a=Integer.parseInt(x[0]);
            int b=Integer.parseInt(x[1]);
            int store=0;
            for(int i=1;i<Integer.min(a, b)+1;i++){
            	if(a%i==0&&b%i==0){
            		store=i;
            	}
            }
            System.out.println(store);
        }
	}

} public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            String[] x=line.split(" ");
            int a=Integer.parseInt(x[0]);
            int b=Integer.parseInt(x[1]);
            int store=0;
            for(int i=1;i<Integer.min(a, b)+1;i++){
            	if(a%i==0&&b%i==0){
            		store=i;
            	}
            }
            System.out.println(store);
        }
	}

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            String[] x=line.split(" ");
            int a=Integer.parseInt(x[0]);
            int b=Integer.parseInt(x[1]);
            int store=0;
            for(int i=1;i<Integer.min(a, b)+1;i++){
            	if(a%i==0&&b%i==0){
            		store=i;
            	}
            }
            System.out.println(store);
        }
	}

}