#include <stdio.h>

// 计算最大公约数
int gcd(int a, int b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

int main() {
    int numerator, denominator;
    scanf("%d %d", &numerator, &denominator);

    // 计算最大公约数
    int greatest_common_divisor = gcd(numerator, denominator);

    // 化简分数
    numerator /= greatest_common_divisor;
    denominator /= greatest_common_divisor;

    printf("%d %d\n", numerator, denominator);

    return 0;
}
