Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	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
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

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

int main(){
    unsigned int a,b,c;
    cin>>a>>b;
    int g,l,p;
    p=a*b;
    while(b!=0){
        c=b;
        b=a%b;
        a=c;
    }
    g=a;
    l=p/g;
    cout<<g<<" "<<l<<endl;
}

C++: /*
 * main.cpp
 *
 *  Created on: 2011/04/09
 *      Author: satoki
 *      10:51 ~ 11:17
 *      ツδーツクツδ環ッツドツづ個古敖渉慊法
 */
#include <iostream>
#include <string.h>
using namespace std;

int iA;
int iB;

int iGCD;
int iLCM;

bool input() {
  if (scanf("%d %d", &iA, &iB) == EOF) return false;
  return true;
}

void manage() {
  int a, b, tmp;
  a = iA;
  b = iB;
  while (b) {
    tmp = a % b;
    a = b;
    b = tmp;
  }
  iGCD = a;
  a = iA;
  b = iB;
  iLCM = a / iGCD * b;
}

int main() {
  while (1) {
    if (!input()) break;
    manage();
    printf("%d %d\n", iGCD, iLCM);
  }
}

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

int main(){

	int a,b,GCD,LCM,c;

	while(cin>>a>>b){

		if(a>b){
			c=b;
		}
		else{
			c=a;
		}

		for(int i=1;i<=(c/2+1);i++){
			if(b%i==0 && a%i==0){
				GCD = i;
			}
		}
		if(b%a==0 || a%b==0){
			GCD = c;
		}
		LCM=a*b/GCD;
		cout<<GCD<<" "<<LCM<<endl;
	}

	return 0;
}

C++: #include<stdio.h>
long long Gcd(long long x,long long y);

int main(void){
	long long a,b,g,lcm;
	int i;
	while( scanf("%lld %lld",&a,&b) != EOF ){
		g=Gcd(a,b);
		lcm=a*b/g;
		
		printf("%lld %lld\n",g,lcm);
	}
	
	return 0;
}

long long Gcd(long long x,long long y){
	int i,j;
	long long tmp;
	if(y>=x){
		tmp=x;
		x=y;
		y=tmp;
	}
	
	for(i=0;;i++){
		x=x%y;
		
		tmp=x;
		x=y;
		y=tmp;
		
		if(y==0){
			break;
		}
	}

	return (x);
}

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

int main()
{
    int a, b, ba, bb;
    int gcd, lcd = 0;
    while(cin >> a >> b)
    {
        ba = a;
        bb = b;
        while(b!=0)
        {
            gcd = b;
            b = a % b;
            a = gcd;
        }
        lcd = ba * bb / gcd;
        cout << gcd << " "<< lcd << endl;
    }
    
    return EXIT_SUCCESS;
}

C++: #include<iostream>

int main(){
	int a,b;
	
	while( std::cin >> a >> b ){
		int num1 = a;
		int num2 = b;
	
		if( a<b ){
			num2 = a;
			num1 = b;
		}
		int gcd;
		while( (gcd = num1%num2) != 0){
			num1 = num2;
			num2 = gcd;
		}
		gcd = num2;
		int lcm = a / gcd * b;
		std::cout << gcd <<" "<< lcm << "\n";
	}
	
	return 0;
}

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

typedef long long ll;

ll gcd(ll a, ll b){
return a != 0 ? gcd(b % a, a) : b;
}

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

C++: #include <iostream>
#include <stdio.h>

using namespace std; 

int gcd( int a, int b )
{
    int temp;

    if( a < b ) { temp = a; a = b; b = temp; }
    if( b < 1 ) return -1;

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


int main(){
  int a,b;
  while(1){
    cin >> a >> b;
    if(cin.eof())
      break;
    int g=gcd(a,b);
    //printf("%d %d\n",g,a/g*b);
    cout << g << a/g*b << endl;
  }

  return 0;
}

C++: #include<stdio.h>
int main(void) {
	long long int a, b, minans = 0, maxans;
	while (scanf("%lld %lld", &a, &b) != EOF)
	{
		for (long long int i = 2; i < b / 2; i++)
		{
			if (a%i == 0 && b%i == 0)maxans = i;
		}
		for (long long int i = 1; i <= a; i++)
		{
			if ((i*b) % a == 0 && (i*b) % b == 0) {
				minans = i*b;
				break;
			}
		}
		printf("%lld %lld\n", maxans, minans);
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main() {
  int a, b;
	while(cin >> a >> b) {
	  cout << __gcd(a, b) << " " << (a*b)/__gcd(a, b) << endl;
	}
  return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
	int a, b, c, d,r,s,h;
	cin >> a >> b;

	//c
	h = a;
	s = b;
	for (;;){
		r = h % s;
		if (r == 0) {
			c = s;
			break;
		}
		h = s;
		s = r;
	}

	//d
	h = a;
	s = b;
	if (a < b){
		for (;;){
			if ((b % a)==0){
				d = b;
				break;
			}
			b = b + s;
		}
	}
	else if(a >= b){
		for (;;){
			if ((a % b) == 0){
				d = a;
				break;
			}
			a = a + h;
		}
	}

	cout << c << " "<< d;
	return 0;
}

C++: #include<stdio.h>
#include<math.h>

int main()
{   
    int a, b;
    int c;
    while (scanf("%d", &a) != EOF) {
        scanf("%d", &b);
        c = a * b;
        while (a != b) {
            if (a > b)
                a = a - b;
            else
                b = b - a;
        }
        printf("%d ", a);
        printf("%d\n", c / a);
    }
}

C++: #include <iostream>
using namespace std;
int main(){
int a,b,gcd,lcm,tmp,r;
while(cin>>num_a>>num_b){
a=num_a,b=num_b;
if(a<b){
tmp = a;
a = b;
b = tmp;
}
r=a%b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
gcd = b;
lcm = (num_a*num_b)/gcd;
cout<<gcd<<" "<<lcm<<endl;
}
return 0;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(1){
	
		int tmp=b;
		b=a%b;
		a=tmp;
		cout<<a<<b<<endl;
		if(b==0)break;
	}
	if(a!=0)cout<<a<<" "<<ta*tb/a<<endl;
	}
	return 0;
}

C++: #include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pf push_front
#define pb push_back
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int gcd(int a,int b){
  if(a<b){
    int tmp=a;
    a=b;
    b=tmp;
  }
  while(b){
    int temp=a%b;
    a=b;
    b=temp;
  }
  return a;
}


signed main(){
  int a,b;
  while(cin>>a>>b){
    cout<<gcd(a,b)<<' '<<a*b/gcd(a,b)<<endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int gcd( int m, int n ){
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

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

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

C++: #include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

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

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

int main()
{
    int a,b;
    while(1){
        cin >> a >> b;
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
}