Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

C++: #include <iostream>
#include <cstdio>
using namespace std;

template <typename T>
T gcd(T a , T b){
	if (b==0) return a;
	return gcd(b , a%b);
}

int main(){
	int a , b ;
	while(cin>>a>>b){
		printf("%d %d\n" , gcd(a,b) , (a/gcd(a, b)*b));
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;

long GCD(long m,long n){
	long remain;
	if((remain = m % n) == 0)return n;
	else return GCD(n,remain);
}

int main(){
	long a,b;
	while(cin >> a >> b){
		cout << GCD(a, b) << " " << a * b / GCD(a, b) << endl;
	}
}

C++: #include<iostream>

using namespace std;

int gcd(int a,int b){
  if(b == 0){
    return a;
  }
  return gcd(b,a%b);
}

int main(){
  int a,b;
  
  while(cin>>a>>b){

  
    int ans1 = gcd(a,b);
    cout<<ans1<<" "<<a/ans1*b<<endl;
  }
  return 0;
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int i;
int js(long long x,long long y)
{
    for(i=1; ;i++)
    {
        if(i%x==0&&i%y==0)
        {
            break;
        }
    }
    return i;
}
main()
{
    long long n,k,j,max,min,x,y,t;
    while(~scanf("%lld %lld",&x,&y))
    {
        max=js(x,y);
        if(x>y)
            {
                t=x;
                x=y;
                y=t;
            }
        while(x!=0)
        {
            t=x;
            x=y%x;
            y=t;

        }
        min=y;
    printf("%lld %lld\n",min,max);
    }

}

C++: #include <iostream>
#include <cstdio>
using namespace std;

int gcd(int a, int b) {
    
  	int p,q,r;
  	if(a>b){p=b;b=a;a=p;}
	while(r!=0){
	q=b/a;
	r=b%a;
	b=a;
	a=r;
	}
	return b;
}

int main(void){
    int a, b;
    while(cin >> a >> b) {
      int lcm = a/gcd(a,b)*b;
      cout << gcd(a,b) << " " << lcm << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int x, int y);
int lcm(int x, int y);
int main()
{
	int x, y;
	while (cin >> x >> y){
		cout << gcd(x, y) << " " << lcm(x, y) << endl;
	}

	return 0;
}

int gcd(int x, int y)
{
	int r;


	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}


int lcm(int x, int y)
{
	return (x * y / gcd(x, y));
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int gcd(int a,int b){
	if(b>a)	swap(a,b);
	while(a%b!=0){
		int tmp=a%b;
		a=b;	b=tmp;
	}
	return b;
}
int main(){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		int g=gcd(a,b);
		cout<<g<<" "<<a/g*b<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
int d(int n,int m)
{
    int t;
    while(m!=0)
    {
        if(n<m) {t=n;n=m;m=t;}
        t=m;
        m=n%m;
        n=t;
    }
    return n;
}
int main()
{
    int t,n,m;
    while( scanf("%d %d",&n,&m))
    {
        t=d(n,m);
        long long l=n/t*m;
        cout<<k<<" "<<l<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
int gcd(int a,int b){
	if(b==0) return a;
	return gcd(b,a%b);
}

int lcm(int a,int b){
	return (a/gcd(a,b))*b;
}

int main(){
	int x,y;
	while(cin>>x>>y){
		cout<<gcd(x,y)<<' '<<lcm(x,y)<<endl;
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[50] = {};
	int b[50] = {};
	int g[50] = {};
	int l[50] = {};
	int i = 0;
	while (cin >> a[i] >> b[i]) {
		i++;
	}
	for (int j = 0; j < i; j++) {
		int n, m,aa,bb;
		aa = a[j];
		bb = b[j];
		while (a[j] != b[j]) {

			m = max(a[j], b[j]);
			n =	max(a[j], b[j])  % min(a[j], b[j]);
			a[j] = m;
			b[j] = n;
			
		}
		g[j] = a[j];
		aa = aa / g[j];
		bb = bb / g[j];
		l[j] = aa * bb * g[j];
		
	}
	for (int k = 0; k < i; k++) {
		cout << g[k] << l[k] << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;

int gcd(int a , int b){
	if (a<b) {
		a^=b;
		b^=a;
		a^=b;
	}
	return a%b ? gcd(a , a%b) : b;
}

int lcm(int a ,int b){
	int c;
	c=a/gcd(a,b);
	return c*b;
}

int main(){
	int a , b ;
	while(cin>>a>>b){
		printf("%d %d\n" , gcd(a,b) , lcm(a , b));
	}
	return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
	int a,b,c;
	int ansG,ansL1,ansL2;
	while(cin>>a>>b){
		ansL1=a;ansL2=b;
		if(a<b){
			int hoge=a;
			a=b;
			b=hoge;
		}
		while(true){
			if(a%b==0){
				ansG=b;
				break;
			}
			else{
				c=a%b;
				a=b;
				b=c;
			}
		}
		ansL1=ansL1/ansG;
		ansL2=ansL2/ansG;
		cout<<ansG<<" "<<ansG*ansL1*ansL2<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <utility>
using namespace std;

int main() {
    int a, b;
    while (cin >> a >> b) {
        if (a > b) swap(a, b);
        int A = a, B = b;
        while ((a % A != 0) && (b % A != 0)) {
            --A;
        }
        while ((B % a != 0) && (B % b != 0)) {
            B += A;
        }
        cout << A << B << endl;
    }
    
    return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

int gcd(long long int a,long long int b){
  return __gcd(a,b);
}
int lcm(long long int a,long long int b){
  return a*b/gcd(a,b);
}

int main(void){
  long long int a,b;
  while(cin>>a>>b){
    long long int ma = max(a,b);
    long long int mi = min(a,b);
    cout<<gcd(ma,mi)<<" "<<lcm(ma,mi)<<endl;
  }
}

C++: #include <iostream>
using namespace std;

int GCD(int c, int d){
    if(c%d == 0){
        return d;
    }
    else{
        return GCD(d, c%d);
    }
}

int main(void){
    long int a, b;
    while(cin >> a >> b){
        if(a < b){
            int x = a;
            a = b;
            b = x;
        }
        long int gcd_a_b = GCD(a, b);
        cout << gcd_a_b << " " << a*b/gcd_a_b << endl;
    }
    return 0;
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <complex>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<double> VEC;
typedef vector<VEC> MAT;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define MT(a,b,c) MP(a, MP(b, c))
#define T1 first
#define T2 second.first
#define T3 second.second.first
#define T4 second.second.second

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EPS 1.0e-9

LL gcd(LL m, LL n){
	LL t;
	while(m){
		t = m;
		m = n % m;
		n = t;
	}
	return n;
}

LL lcm(LL m, LL n){	
	LL g = gcd(m, n);
	return m / g * n;
}

int main(){
	int p,q;
	while(cin>>p>>q)cout << gcd(p,q) << " " << lcm(p,q) << endl;
	return 0;
}