#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) 
{
    int temp;
    while (b != 0) 
    {
        temp = a % b;
        a = b;
        b = temp;
    }
    return a;
}
int main()
{
	ifstream f1("BAI1_17.INP");
	ofstream f2("BAI1_17.OUT");
	int a;
	int b;
	f1>>a>>b;
	int c;
	int d;
	c=a/gcd(a,b);
	d=b/gcd(a,b);
	f2<<c<<' '<<d;
	f1.close();
	f2.close();
}

