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 <cstdio>

int main()
{
    long a, b;
    long m, n, temp;

    while (scanf("%ld %ld", &a, &b) != EOF) {
        if (a < b) {
            temp = a;
            b = a;
            a = temp;
        }
        m = a;
        n = b;

        while (n > 0) {
            temp = n;
            n = m % n;
            m = temp;
        }

        printf("%ld %ld\n", m, a / m * b);
    }

    return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <map>

typedef long long ll;
using namespace std;

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

int main()
{
int a,b;
while(~scanf("%d %d",&a,&b)){
printf("%d %d\n",gcd(a,b),a/gcd(a,b)*b);
}
}

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

int main(){

int small,big,i,c,kouyaku,koubai;

while(cin >> small >> big){

if(small>big){//大小比較
c=big;
big=small;
small=c;
}

for(i=1;i<=big;i++){//最大公約数
if(big%i==0 && small%i==0)kouyaku=i;
}

for(i=1;i<=small;i++){//最小公倍数

if((big*i)%small==0){
koubai=big*i;
break;
}
}

cout << kouyaku << " " <<koubai << endl;//出力
}
return 0;
}

C++: #include <iostream>

typedef unsigned int ui;

void swap(ui & a, ui & b)
{
	unsigned int tmp = a;
	a = b;
	b = tmp;
}

ui gcd(ui a, ui b)
{
	if (a < b) swap(a, b);

	ui c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}

	return b;
}

int main() {
	using namespace std;

	ui a, b;
	while (cin >> a >> b) {
		const ui GCD = gcd(a, b);
		const ui LCM = (a / GCD) * (b / GCD) * GCD;
		cout << GCD << ' ' << LCM << endl;
	}
	return 0;
}

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

int main(){

	u_int a, b;

	while(std::cin >> a >> b){

		u_int minmul; //least common multiple
		u_int maxdivi = 1; //greatest common divisor
		u_int tmp_a = a;
		u_int tmp_b = b;

		if(a == 0 || b == 0){
			std::cout << 0 << " " << 0 << std::endl;

		}else{					//Euclidean Algorithm

			if(b > a)
				std::swap(a, b);

			while(a % b != 0){
				a = a % b;
				if(b > a)
					std::swap(a, b);
			}
		
		maxdivi = b;
		minmul = (tmp_a / maxdivi) * tmp_b; //a*b/maxdivi

		std::cout << maxdivi << " " << minmul << std::endl;
		}
	}

	return 0;
}

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

using namespace std;

int main()
{
	unsigned long a, b, r, c, d;
	unsigned long ta, tb;

	scanf("%d%d", &a,& b);
	ta = a;
	tb = b;

	while (1) {
	r = ta % tb;
	if (r == 0) break;
	ta = tb;
	tb = r;
	}
	c = tb;

	
	d = a * (b  / c);
	

	printf("%d %d\n", c, d);

	return (0);
}

C++: #include<iostream>

using namespace std;

int a, b, c, d;
int GCD, LCM;
int change;
int main()
{
	while(cin>>a>>b)
	{
		if(a<b)
		{
			change=a;
			b=a;
			a=change;
		}
		c=a;d=b;
		while(d!=0)
		{
			change=d;
			d=c%d;
			c=change;
		}
		GCD=c;
		LCM=a/GCD*b;
		printf("%d %d\n",GCD,LCM);
	}
}

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

long int Gcm(long int a,long int b){

    long int temp=0;
    long int r=1;
    //aとbの最大公約数を求める
    //a,b入力を行う（a>b）。a=b*q+rの形で計算していく
    //b%rの値が０になったときのbがa,bの最大公約数(cとする)となる
    //最小公倍数は、c*a'=a,c*b'=bを満たすa',b'とcとの積である
    if(a<b){
        temp = a;
        a = b;
        b = temp;
    }
    while(r!=0){
        r = a%b;
        a = b;
        b = r;//aが最大公約数
    }
    return a;
}

int main(){
    long int x,y;
    long int gcd,lcm;

    while(cin >> x >> y){

    gcd = Gcm(x,y);

    x = x/gcd;
    y = y/gcd;

    lcm = x * y * gcd;

    cout << gcd <<" "<< lcm << endl;
    }
    return 0;
}

C++: #include <stdio.h>

int main(){
    int a,b,m,l;
    while(scanf("%d %d",&a,&b)!=EOF){
        m = a%b;
        l = a*b;
        while(m){
            a = b;
            b = m;
            m = a%b;
        }
        printf("%d %d\n",b,l/b);
    }
}

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

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

int main() {
	long long int a, b, t, aa, bb;

	while (1) {
		cin>>a;
		if (a==0)
			break;
		cin>>b;

		aa = a;
		bb = b;

		while (1) {
			if (b==0) break;

			t = b;
			b = a % b;
			a = t;
		}
		cout<<a<<" "<<aa*bb/a<<endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <stack>
#include <map>
#include <queue>
#include <algorithm>
#define PI 3.1415926535897932
#define MAX(a,b) ((a>b)?(a):(b)) // ?????§????????????
#define MIN(a,b) ((a<b)?(a):(b)) // ????°?????????????
#define INRANGE(a,b,c) ((a<=b&&b<=c)?(1):(0)) // a<=b<=c??????????????????????????????

int zeller(int y,int m,int d){ // ?????§??????
	if(m<3){y--; m+=12;}
	return (y+y/4-y/100+y/400+(13*m+8)/5+d)%7;
}

int gcd(int a,int b){	// ?????§??¬?´???°
	if(b==0) return a;
	return gcd(b,a%b);
}

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

int main(void){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		printf("%d %d\n",gcd(a,b),lcm(a,b));
	}
	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<algorithm>


int yukurid(int, int);

int main()
{
	int a, b;
	while (scanf("%d %d", &a, &b) != EOF)
	{
		int tmp = a;
		a = a < b ? b : a;
		b = tmp < b ? tmp : b;
		printf("%d %d\n", ((a*b)/yukurid(a,b)),yukurid(a, b));
	}
	return 0;

}

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

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, a, b;
	
	while(std::cin >> a >> b){
		if(a > b) gcd = calcGcd(a, b);
		else gcd = calcGcd(b, a);
		lcm = calcLcm(a, b, 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<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int v[100000];

void division(long int a,long int b,long int *L,long int *G){
  long int i;
  int j=0;
  for(i=2;i<2000000000;i++){
    if(a%i==0 && b%i==0){   //a??¨b?????¨???????????????????????????
      a/=i;  b/=i;
      v[j]=i;    //?????£???????????\????????????
      i--;
      j++;   //?????£?????????????´???´???
    }
    if(i>a || i>b){
      break;
    }
  }
  for(i=0;i<j;i++){
    (*G) *=v[i];
  }
  *L = (*G) * a * b;
}

int main(void){
  long int GCD=1;
  long int LCM=1;
  long int a,b;

  while(cin>>a>>b){
    GCD=1;LCM=1;
    division(a,b,&LCM,&GCD);
    printf("%d %d",GCD,LCM);
  }
  printf("\n");

  return 0;
  
}

C++: #include <bits/stdc++.h>
// #include "bits/stdc++.h"

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };
 
typedef long long ll;
using namespace std;
 
int main() {
  int a,b;
 
  while(cin >> a >> b){
    int g = gcd(a,b);
    cout << g << " " << a/g*b << endl;
  }
  return 0;
}

C++: #include<iostream>
main(){for(int a,b,x,y,t;std::cin>>a>>b;printf("%d %d\n",a,x/a*y))for(x=a,y=b;t=b;a=t)b=a%b;}