#include <iostream>
using namespace std;

int gcd(int a,int b){
	return b ? gcd(b,a%b) : a;
}
int lcm(int a,int b)
{
	return a/gcd(a,b)*b;
}
int main()
{
	int x,y;
	while(cin >> x >> y && x != -1)
		printf("%d %d\n",gcd(x,y),lcm(x,y));
}