#include <iostream>
using namespace std;

typedef unsigned int uint;

uint func1(uint a,uint b){
    while(a != b){
        if(a>b)a-=b;
        else b-=a;
    }
    return a;
}

uint func2(const uint a,const uint b){
    uint a2=a,b2=b;
    while(a2 != b2){
        if(a2>b2)b2+=b;
        else a2+=a;
    }
    return (a2>=2000000000)?2000000000:a2;
}

int main(){
    uint a,b;
    cin >> a >> b;
    if(a>2000000000 || b>2000000000)return 0;

    cout << func1(a,b) << " " << func2(a,b);

    return 0;
}