#include <iostream>
#include <cmath>

using namespace std;

int64_t rez(int64_t a, int64_t b)
{
   if(b == 0)return a;
   else
   return rez(b, a%b);
}

int main()
{
int64_t a, b, cc;
while(a != -1)
{
   cin >> a >> b;
   cc = rez(a, b);
   cout << rez(a, b) <<' ' << (a*b)/rez(a, b) << endl;
}
}