import java.util.Scanner;
public class Gcd {
/**
* @param 欧几里得算法求最大公约数
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int a=0;
int b=0;
Scanner console = new Scanner(System.in);
while(console.hasNext()){
a = console.nextInt();
b = console.nextInt();
break;
}
System.out.println(a + "和" + b +"的最大公约数是"+ gcd(a,b));
}
private static int gcd(int a, int b) {
// TODO Auto-generated method stub
if(b == 0)
return a;
return gcd(b,a%b);
}
}