#include <iostream>

int gcd(int a, int b){
    int remainder;
    while((remainder = (a % b)) != 0) {
        a = b;
        b = remainder;
    }
    return b;
}

int lcm(int a, int b){
    return ((a / gcd(a, b)) * b);
}

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cout << gcd(a, b) << " " << lcm(a, b) << std::endl;
    }
    return 0;
}