#include <fstream>
using namespace std;
unsigned long long _number1;
unsigned long long _number2;
unsigned long long _cc;
int Gdc (unsigned long long num1,unsigned long long num2) {
unsigned long long temp;
while (num2 > 0) {
temp = num1 % num2;
num1 = num2;
num2 = temp;
}
return num1;
}
int main () {
ifstream in ("yuefen.in");
ofstream out ("yuefen.out");
in >> _number1;
in >> _number2;
if (_number1 == 0) {
out << _number1;
return 0;
}
_cc = Gdc(_number1,_number2);
_number1 /= _cc;
_number2 /= _cc;
if (_number2 == 1) {
out << _number1;
return 0;
}
out << _number1 << ' ' << _number2;
in.close();
out.close();
return 0;
}