#include <iostream>
#include <fstream>
using namespace std;
int main()
{
	ifstream f1;f1.open("DE001.INP");
	int a,b,x,y,i;
	while((a!=0)&&(b!=0))
	{
	f1>>a>>b;
	x=a;
	y=b;
	
	while(x!=y)
	{
		if(y>x)
		{
			i=x;
			x=y;
			y=i;	
		}
		x=x-y;
	}
	f1.close();
	ofstream f2;f2.open("DE001.OUT");
	f2<<a/x<<" "<<b/x<<endl;
	f2.close();}
}
