import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int m = scanner.nextInt();
int n = scanner.nextInt();
int max = 0;
int min = 0;
int index = (m <= n) ? m : n;
for (int i = 1; i <= index; i++) {
if (m % i == 0 && n % i == 0) {
max = i;
}
}
for (int i = 1; ; i++) {
if (i % m == 0 && i % n == 0) {
min = i;
break;
}
}
System.out.println("最大公约数为" + max);
System.out.println("最小公倍数为"+ min);
scanner.close();
}
}