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