#include <bits/stdc++.h>
using namespace std;
int uc(int a,int b)
{
	int r;
	if(b==0)return a;
	else
	{

	while(b>0)
	{
		r=a%b;
		a=b;
		b=r;
	}
	return a;
}
}
int main()
{
	ifstream f1("BAI1_14.INP");
	ofstream f2("BAI1_14.OUT");
	int a,b,k;
	f1>>a>>b;
	if (b < 0)
    {
        a = -a; b = -b;
    }
	if(a<0)k=a*(-1);
	int x;
	x=uc(k,b);
	f2<<a/x<<" "<<b/x;
}
