#include <fstream>

using namespace std;

ifstream input("Bai1_17.inp");
ofstream output("Bai1_17.out");

int GCD(int a, int b)
{
	return (b == 0) ? a : GCD(b, a % b);
}

int main()
{
	int a, b;
	input >> a >> b;
	int ucln = GCD(a, b);
	output << a / ucln << ' ' << b / ucln;
	input.close();
	output.close();
	return 0;
}