#include <fstream>
using namespace std;
int main()
{
    ifstream f1("de001.inp");
    ofstream f2("de001.out");
    int a,b;
    while (a != 0 || b != 0)
    {
        f1 >> a >> b;
        if (a==0 && b==0) break;
        if (b < 0) {a = -a;b = -b;}
        int x,y;
        if (a < 0) x = -a;
        else x = a;
        if (b < 0) y = -b;
        else y = b;
        while (x != y)
        {
            if (y > x) y = y - x;
            else x = x - y;
        }
        f2 << a/x << " " << b/x << endl;
    }
    f1.close();
    f2.close();
    return 0;
}
