import std.stdio;
import std.conv;
import std.algorithm;
import std.string;
import std.file;
import std.math;
 
int main() {
        string l;
        while((l = readln()).length >= 2){
                int a, b, aorg, borg, r;
                a = aorg = to!int(l.split()[0]), b = borg = to!int(l.split()[1]);
                while(b > 0){
                        a = a - (a / b) * b;
                        r = a, a = b, b = r;
                        }
                printf("%d %d\n", a, aorg / a * borg);
                }
        return 0;
}