#include <fstream>
using namespace std;
ifstream f1("bai1_17.inp");
ofstream f2("bai1_17.out");
long t,m;
int main()
{
    f1 >> t >> m;
    long a = t,b = m;
    while (a != b)
    {
        if (a > b) a = a-b;
        else b = b - a;
    }
    f2 << t/a << " " << m/a;
    return 0;
}
