Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Printf("%d %d\n", y, lcm/y)
	}
}

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;
}

C++: #include<iostream>
#include<utility>

int main(){
  unsigned int a,b,tmp,GCD;
  while ( std::cin >> a >> b){
   unsigned long int LCM = a;
    if( b > a )std::swap( a , b );
    GCD = b;
    while(a % GCD != 0){
      tmp = a % GCD;
      a = GCD;
      GCD = tmp;
    }
    LCM = ( LCM / GCD ) * b;
    std::cout << GCD << " " << LCM << std::endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y){
	if(y == 0) return x;
	else return gcd(y, x % y);
}

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

C++: #include<iostream>
#include<algorithm>

using namespace std;

int a,b;

void search(int t)
{
	int r;
	
	if(r==0)
		return;
	
	if(t==1)
	{
		r=a%b;
		a=r;
		search(t=0);
	}
	else
	{
		r=b%a;
		b=r;
		search(t=1);
	}
	
}

int GCD ( int x, int y )
{
	if( y == 0 ){
		return x;
	}
	else{
		GCD( y, x%y );
	}
}

int main()
{
	int a2,b2;
	
	for(;cin >> a;)
	{
		cin >> b;
/*		a2=a;
		b2=b;
		
		a=max(a2,b2);
		b=min(a2,b2);
		
		search(1);
		
		a=max(a,b);
		
		cout << a << " " << a2*(b2/a) << endl;
*/
		int gcd = GCD( a, b );
		cout << gcd << " " << a/gcd * b << endl;
	}
}

C++: #include <iostream>

using namespace std;

int gcd(long long a, long long b) {
  while (!a == 0 && !b == 0) {
    if (a >= b) {
      a %= b;
    } else {
      b %= a;
    }
  }
  if (a == 0) {
    return b;
  } else {
    return a;
  }
}

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