import java.util.Scanner;

public class Main {
	public static int euclidean(int x, int y) {
		int result = -1, z = 1;
		while (z > 0) {
			z = x % y;
			if (z == 0) result = y;
			x = y; y = z;
		}
		return result;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (y > x ) {
			int tmp = x; x = y; y = tmp;
		}
		int factor = euclidean(x, y);
		if (factor == -1) {
			System.out.println("not exist Greatest common factor");
		} else {
			System.out.println(euclidean(x, y));
		}
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static int euclidean(int x, int y) {
		int result = -1, z = 1;
		while (z > 0) {
			z = x % y;
			if (z == 0) result = y;
			x = y; y = z;
		}
		return result;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (y > x ) {
			int tmp = x; x = y; y = tmp;
		}
		int factor = euclidean(x, y);
		if (factor == -1) {
			System.out.println("not exist Greatest common factor");
		} else {
			System.out.println(euclidean(x, y));
		}
	}
} Main public static int euclidean(int x, int y) {
		int result = -1, z = 1;
		while (z > 0) {
			z = x % y;
			if (z == 0) result = y;
			x = y; y = z;
		}
		return result;
	} euclidean {
		int result = -1, z = 1;
		while (z > 0) {
			z = x % y;
			if (z == 0) result = y;
			x = y; y = z;
		}
		return result;
	} int result = -1 result -1 1 z = 1; z 1 while (z > 0) {
			z = x % y;
			if (z == 0) result = y;
			x = y; y = z;
		} z > 0 z 0 {
			z = x % y;
			if (z == 0) result = y;
			x = y; y = z;
		} z = x % y z x % y x y if (z == 0) result = y; z == 0 z 0 result = y result y x = y x y y = z y z return result; result int x x int y y public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (y > x ) {
			int tmp = x; x = y; y = tmp;
		}
		int factor = euclidean(x, y);
		if (factor == -1) {
			System.out.println("not exist Greatest common factor");
		} else {
			System.out.println(euclidean(x, y));
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (y > x ) {
			int tmp = x; x = y; y = tmp;
		}
		int factor = euclidean(x, y);
		if (factor == -1) {
			System.out.println("not exist Greatest common factor");
		} else {
			System.out.println(euclidean(x, y));
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int y = sc.nextInt(); y sc.nextInt() sc.nextInt sc if (y > x ) {
			int tmp = x; x = y; y = tmp;
		} y > x y x {
			int tmp = x; x = y; y = tmp;
		} int tmp = x; tmp x x = y x y y = tmp y tmp int factor = euclidean(x, y); factor euclidean(x, y) euclidean x y if (factor == -1) {
			System.out.println("not exist Greatest common factor");
		} else {
			System.out.println(euclidean(x, y));
		} factor == -1 factor -1 1 {
			System.out.println("not exist Greatest common factor");
		} System.out.println("not exist Greatest common factor") System.out.println System.out System System.out "not exist Greatest common factor" {
			System.out.println(euclidean(x, y));
		} System.out.println(euclidean(x, y)) System.out.println System.out System System.out euclidean(x, y) euclidean x y String[] args args public class Main {
	public static int euclidean(int x, int y) {
		int result = -1, z = 1;
		while (z > 0) {
			z = x % y;
			if (z == 0) result = y;
			x = y; y = z;
		}
		return result;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (y > x ) {
			int tmp = x; x = y; y = tmp;
		}
		int factor = euclidean(x, y);
		if (factor == -1) {
			System.out.println("not exist Greatest common factor");
		} else {
			System.out.println(euclidean(x, y));
		}
	}
} public class Main {
	public static int euclidean(int x, int y) {
		int result = -1, z = 1;
		while (z > 0) {
			z = x % y;
			if (z == 0) result = y;
			x = y; y = z;
		}
		return result;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (y > x ) {
			int tmp = x; x = y; y = tmp;
		}
		int factor = euclidean(x, y);
		if (factor == -1) {
			System.out.println("not exist Greatest common factor");
		} else {
			System.out.println(euclidean(x, y));
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static int euclidean(int x, int y) {
		int result = -1, z = 1;
		while (z > 0) {
			z = x % y;
			if (z == 0) result = y;
			x = y; y = z;
		}
		return result;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		if (y > x ) {
			int tmp = x; x = y; y = tmp;
		}
		int factor = euclidean(x, y);
		if (factor == -1) {
			System.out.println("not exist Greatest common factor");
		} else {
			System.out.println(euclidean(x, y));
		}
	}
}

