#include <fstream>
using namespace std;
int main()
{
    ifstream f1("PS.inp");
    ofstream f2("PS.out");
    int a,b;
    while (a!=0)
    {
        while (b!=0)
        {
            f1 >> a >> b;
            for (int i = a; i > 0; i++)
            {
                if (a%i==0)
                {
                    if (b%i==0)
                    {
                        f2 << a/i << b/i;
                        break;
                    }
                }
            }
        }
    }
    f1.close();
    f2.close();
    return 0;
}
