#include <iostream>
#include <iomanip>
using namespace std;

int main(void)
{
    int a, b;
    while (cin >> a >> b) {
        int c, d;
        for (int i = a; 0 < i; --i) {
            if (a % i + b % i == 0) {
                c = i;
                break;
            }
        }
        for (int i = b; b < 2000000000; ++i) {
            if (i % a + i % b == 0) {
                d = i;
                break;
            }
        }
        cout << c << " " << d << endl;
    }
    return 0;
}





