import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] n = line.split(" ");

		int x = Integer.parseInt(n[0]);
		int y = Integer.parseInt(n[1]);

		int z = Math.max(x, y) % Math.min(x, y);

		int gcd = 1;

		if (x == y) {
			gcd = x;
		} else {
			for (int i = 1; i <= z; i++) {
				if (x % i == 0 && y % i == 0) {
					gcd = i;
				}
			}
		}

		System.out.println(gcd);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] n = line.split(" ");

		int x = Integer.parseInt(n[0]);
		int y = Integer.parseInt(n[1]);

		int z = Math.max(x, y) % Math.min(x, y);

		int gcd = 1;

		if (x == y) {
			gcd = x;
		} else {
			for (int i = 1; i <= z; i++) {
				if (x % i == 0 && y % i == 0) {
					gcd = i;
				}
			}
		}

		System.out.println(gcd);

	}

} Main public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] n = line.split(" ");

		int x = Integer.parseInt(n[0]);
		int y = Integer.parseInt(n[1]);

		int z = Math.max(x, y) % Math.min(x, y);

		int gcd = 1;

		if (x == y) {
			gcd = x;
		} else {
			for (int i = 1; i <= z; i++) {
				if (x % i == 0 && y % i == 0) {
					gcd = i;
				}
			}
		}

		System.out.println(gcd);

	} main {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] n = line.split(" ");

		int x = Integer.parseInt(n[0]);
		int y = Integer.parseInt(n[1]);

		int z = Math.max(x, y) % Math.min(x, y);

		int gcd = 1;

		if (x == y) {
			gcd = x;
		} else {
			for (int i = 1; i <= z; i++) {
				if (x % i == 0 && y % i == 0) {
					gcd = i;
				}
			}
		}

		System.out.println(gcd);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc String[] n = line.split(" "); n line.split(" ") line.split line " " int x = Integer.parseInt(n[0]); x Integer.parseInt(n[0]) Integer.parseInt Integer n[0] n 0 int y = Integer.parseInt(n[1]); y Integer.parseInt(n[1]) Integer.parseInt Integer n[1] n 1 int z = Math.max(x, y) % Math.min(x, y); z Math.max(x, y) % Math.min(x, y) Math.max(x, y) Math.max Math x y Math.min(x, y) Math.min Math x y int gcd = 1; gcd 1 if (x == y) {
			gcd = x;
		} else {
			for (int i = 1; i <= z; i++) {
				if (x % i == 0 && y % i == 0) {
					gcd = i;
				}
			}
		} x == y x y {
			gcd = x;
		} gcd = x gcd x {
			for (int i = 1; i <= z; i++) {
				if (x % i == 0 && y % i == 0) {
					gcd = i;
				}
			}
		} for (int i = 1; i <= z; i++) {
				if (x % i == 0 && y % i == 0) {
					gcd = i;
				}
			} int i = 1; int i = 1; i 1 i <= z i z i++ i++ i {
				if (x % i == 0 && y % i == 0) {
					gcd = i;
				}
			} {
				if (x % i == 0 && y % i == 0) {
					gcd = i;
				}
			} if (x % i == 0 && y % i == 0) {
					gcd = i;
				} x % i == 0 && y % i == 0 x % i == 0 x % i x i 0 y % i == 0 y % i y i 0 {
					gcd = i;
				} gcd = i gcd i System.out.println(gcd) System.out.println System.out System System.out gcd String[] args args public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] n = line.split(" ");

		int x = Integer.parseInt(n[0]);
		int y = Integer.parseInt(n[1]);

		int z = Math.max(x, y) % Math.min(x, y);

		int gcd = 1;

		if (x == y) {
			gcd = x;
		} else {
			for (int i = 1; i <= z; i++) {
				if (x % i == 0 && y % i == 0) {
					gcd = i;
				}
			}
		}

		System.out.println(gcd);

	}

} public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] n = line.split(" ");

		int x = Integer.parseInt(n[0]);
		int y = Integer.parseInt(n[1]);

		int z = Math.max(x, y) % Math.min(x, y);

		int gcd = 1;

		if (x == y) {
			gcd = x;
		} else {
			for (int i = 1; i <= z; i++) {
				if (x % i == 0 && y % i == 0) {
					gcd = i;
				}
			}
		}

		System.out.println(gcd);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] n = line.split(" ");

		int x = Integer.parseInt(n[0]);
		int y = Integer.parseInt(n[1]);

		int z = Math.max(x, y) % Math.min(x, y);

		int gcd = 1;

		if (x == y) {
			gcd = x;
		} else {
			for (int i = 1; i <= z; i++) {
				if (x % i == 0 && y % i == 0) {
					gcd = i;
				}
			}
		}

		System.out.println(gcd);

	}

}