#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,t;
int ucln(int a,int b)
{
    int r;
    while (b!=0)
    {
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
int main()
{
	ifstream f1("bai1_17.inp");
	ofstream f2("bai1_17.out");
	f1>>a>>b;
	t=ucln(a,b);
	c=a/t;
	d=b/t;
	if(ucln(c,d)==1)
	{
	f2<<c<<" "<<d;
    }
    else
    system("pause");
	f1.close();
	f2.close();
	return 0;
}
