#include <iostream>

using namespace std;

int main()
{int a,b;
    int gcd(int ,int );
    int lcm(int ,int );
    cin>>a>>b;
    cout << gcd(a,b)<<endl<<lcm(a,b) << endl;
    return 0;
}

int gcd(int x,int y)
{int r=1,m=1;
    while (r)
    {
        if(x>y)
        {r=x=x%y;m=y;}
    else
        {r=y=y%x;m=x;}
    }
    return m;
}
int lcm(int x,int y)
{int i=1;
    while (i>=1)
    {
    if (i%x==0&&i%y==0)
        break;
    else
        i++;
    }
    return i;
}