#include <iostream>
#include <fstream>
using namespace std;
int main()
{
	int x1,x2,r;
	int ucln;
	int y1,y2,z1,z2;
	ifstream fi("DE001.inp");    
	ofstream fo("DE001.out");
	fi>>x1>>x2;
	while(not((x1==0)&&(x2==0)))
	{	 
	    z1=x1;
	 	z2=x2;
		if(z1<z2)
			{
				int t;
				t=z1;
				z1=z2;
				z2=t;
			}
		while(z1!=z2)
		{
			
			r=z1-z2;
			
			if(r>z2)
			{
				z1=r;
			}
			else
			{
				z1=z2;
				z2=r;
			}	
		}
		ucln=z1;
		y1=x1/ucln;
		y2=x2/ucln;
		if((y1<0)&&(y2<0))
		{
			y1=0-y1;
			y2=0-y2;
		}
		fo<<y1<<" "<<y2<<endl;
		fi>>x1>>x2;
	}
	fi.close();
	fo.close();
}
