#include <fstream>
#include <iostream>
using namespace std;
int ucln(int m,int n)
{
    while (n > 0)
    {
        int r = m%n;
        m = n;
        n = r;
    }
    return m;
}
int main()
{
    ifstream f1("DE001.inp");
    ofstream f2("DE001.out");
    int a,b,x,y;
    while (a != 0 && b != 0)
    {
      f1>>a>>b;
      x = a/ucln(a,b);
      y = b/ucln(a,b);
      f2<<x<<" "<<y<<endl;
    }
    return 0;
}



