#include <fstream>

using namespace std;

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

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

long long ABS(long long a)
{
	return (a > 0) ? a : -a;
}

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