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 count == 51 {
			break
		}
		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>
#include <algorithm>
using namespace std;

long gcd(long a, long b){
    if(a < b){
        swap(a, b);
    }else{
        while(b > 0){
            long r = a % b;
            a = b;
            b = r;
        }
    }
    return a;
}

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

C++: #include<iostream>
using namespace std;
int main(){
    int  i,a,b,c;
    while(cin>>a>>b){
        if(a==b){
            cout<<a<<" "<<a<<endl;
        }
        else{
        if(a<b){
            i=b-a;
        }
        else{
            i=a-b;
        }
    for( int j=i;j>0;i-=2){
        if(a%i==0 && b%i==0){
            c=i;
            break;
        }
    }
    cout<<c<<" "<<a*b/c<<endl;
        }
    }
    return 0;
}

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


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

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

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

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

struct xy
{
	long long x;
	long long y;
};

int getGCD(int a, int b) {
	if (b != 0)
		return getGCD(b, a%b);
	else
		return a;
}
int main()
{
	int a, b;
	vector<xy> dst;
	while (cin >> a >> b ) {
		int GCD = a > b ? getGCD(a, b) : getGCD(b, a);
		long long LCD = long long(a) * long long(b) / long long(GCD);
		dst.push_back({ GCD ,LCD });
	}
	for (vector<xy>::iterator it = dst.begin(); it < dst.end(); it++)
		cout << (*it).x << " " << (*it).y << endl;
	return 0;
}

C++: #include <iostream>

#define MAX(x,y) ((x>y)?x:y)
#define MIN(x,y) ((x>y)?y:x)
int main(void)
{
	while(true)
	{
		int x=0,y=0;
		double product;
		std::cin >> x >> y;
		if(std::cin.eof())
			break;
		product = (double)x*y;
		//ユークリッドの何とか
		while(x && y){
			if(x>y)
				x = x % y;
			else
				y = y % x;
		}
		std::cout << (int)MAX(x,y) << " " << (int)(product/MAX(x,y)) << std::endl;//確かGCD*LCMと元の積は等しいはず。
	}
	return 0;
}

C++: #include<cstdio>

int main() {
	int a, b,c,A,B;

	while (scanf("%d %d", &a, &b) != EOF) {
		A = a;
		B = b;
		while (b != 0) {
			c = a%b;
			a = b;
			b = c;
		}
		printf("%d %d\n", a, A / a*B);
	}
	return 0;
}

C++: /********************************************************************
 * ??£?????´??° a,b ?????\?????????a ??¨ b ????????§??¬?´???°??¨????°???¬?????°???????????????
 * ????????°?????????????????????????????????
 ********************************************************************/
#include <iostream>
#include <cstring>
typedef struct _input_values {
    int a;
    int b;
} INPUT_VALUES;

typedef struct _input_values_list {
    INPUT_VALUES sList[10];
    int effectCount;
} INPUT_VALUES_LIST;

int gcd( int a, int b );    // ?????§??¬?´???°????±???????
int lcm( int a, int b, int g );    // ????°???¬?????°????±???????

using namespace std;

int main()
{
    int i = 0;
    int tA = 0, tB = 0;
    int g = 0, l = 0;
    static INPUT_VALUES_LIST values;

    memset( &values, 0, sizeof(values) );

    while( cin >> tA >> tB ) {
        values.sList[values.effectCount].a = tA;
        values.sList[values.effectCount].b = tB;
        values.effectCount++;
    }

    for ( i = 0; i < values.effectCount; i++ ) {
        g = gcd( values.sList[i].a, values.sList[i].b );
        l = lcm( values.sList[i].a, values.sList[i].b, g );
        cout << g << " " << l << endl;
    }

    return 0;
}

/*  @brief  ?????§??¬?´???°????±???????
 *  @param  [i] a   ???????????????
 *  @param  [i] b   ???????????????
 *  @retval ?????§??¬?´???°
 */
int gcd( int a, int b )
{
    int ret = 0;

    if ( 0 == a || 0 == b ) {
        return 0;
    }

    if ( a != b ) {
        if ( a > b ) {
            a = a - b;
        } else {
            b = b - a;
        }
    } else {
        return a;
    }

    ret = gcd( a, b );

    return ret;
}

/*  @brief  ????°???¬?????°????±???????
 *  @param  [i] ???????????????
 *  @param  [i] ???????????????
 *  @param  [i] ?????§??¬?´???°
 *  @retval ????°???¬?????°
 */
int lcm( int a, int b, int g )
{
    if ( 0 == a || 0 == b ) {
        return 0;
    }

    return ( a * b / g );
}

C++: #include <iostream>

//最大公約数を求めるプログラム(m >= n)
int calcGcd(int m, int n);
//最小公倍数を求めるプログラム
inline int calcLcm(int m, int n, int gcd);

int main(){
	int gcd, lcm, x, y;
	
	while(std::cin >> x >> y){
		if(x > y) gcd = calcGcd(x, y);
		else gcd = calcGcd(y, x);
		lcm = calcLcm(x, y, gcd);
		
		std::cout << gcd << " " << lcm << std::endl;
	}
	
	return 0;
}

int calcGcd(int m, int n){
	return n == 0 ? m : calcGcd(n, m%n);
}

inline int calcLcm(int m, int n, int gcd){
	return m / gcd * n;
}

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



long long gcm(long long a, long long b){
	if(b > a){
	long long d;
	d = a;
	a = b;
	b = d;
	}	
	long long c;
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}
int main(){
	for(int i=1;i<=2;i++){
	long long c,d,e;
	std::cin>>c>>d;
	e = gcm(c,d);
	std::cout<<e<<" "<<((c/e)*(d/e)*e)<<endl;
	}
}

C++: #include <iostream>

using namespace std;

int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i>j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	if(i % j ==0){
		return j;
	}
	
	i %= j;
	int tmp;
	tmp = i;
	i = j;
	j = tmp;
	return gcd(i, j);
}

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <string>
#include <iomanip>
#include <math.h>
#include <limits>

using namespace std;

typedef unsigned long long ullong;

class cgl
{
public:
	ullong gcd(ullong, ullong);
	ullong lcm(ullong, ullong, ullong);
};

ullong cgl::gcd(ullong a, ullong b)
{
	if (a % b == 0)
		return b;
	return gcd(b, a % b);
}

ullong cgl::lcm(ullong a, ullong b, ullong g)
{
	return a * b / g;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	cgl cg;
	ullong a, b, g;

	for (;;)
	{
		cin >> a >> b;
		if (cin.fail()) break;
		g = cg.gcd(a, b);
		cout << g << " " << cg.lcm(a, b, g) << endl;
	}

	return 0;
}

C++: #include <cstdio>
using namespace std;
long long int gcd(long long int m,long long int n)
{
	if (n == 0)
		return m;
	return gcd(n,m % n);
}

int main()
{
	long long int a, b;
	while (scanf("%lld %lld",&a,&b) != EOF) {
		if (a >= b)
			printf("%lld %lld\n",gcd(a, b),a*b/ gcd(a, b));
		else
			printf("%lld %lld\n", gcd(b, a), a*b / gcd(b, a));
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	
	int a, b, c = 0;
	while (cin >> a, cin >> b)
	{
		for (int i = 1; i <= a, i <= b; i++)
		{
			if (a % i == 0 && b % i == 0)
			{
				c = i;
			}
		}
		cout << c << " " << a*b / c << endl;
	}
	getchar();
	getchar();
	return 0;
}