Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

func gcd(x, y int) int {
	if x < y {
		gcd(y, x)
	}
	for 0 < y {
		r := x % y
		x, y = y, r
	}
	return x
}

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

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

int main(){
int a;
int b;
int c;
int d;
int e;
while(cin>>d>>e){
a=d;
b=e;
while(1){
c=a%b;
a=b;
b=c;
if(b=0){break;}
}
cout << a <<" ";
cout << (d*e)/a <<endl;}}

C++: #include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
	int n = 45000;
	int p[n] = {};
	for(int i=2;i<n;i++){
		if(p[i]==0) for(int j=2;j<n/i;j++) p[i*j] = 1;
	}
	int q[n];
	int c = -1;
	for(int i=2;i<n;i++){
		if(p[i]==0){
			c++;
			q[c] = i;
		}
	}
	long a,b;
	while(cin >> a >> b){
		int t[c] = {};
		int s[c] = {};
		int as = a;
		while(1){
			int temp = as;
			for(int i=0;i<c;i++){
				if(as%q[i]==0){
					s[i]++;
					as = as/q[i];
				}
			}
			if(temp==as) break;
		}
		int at = b;
		while(1){
			int temp = at;
			for(int i=0;i<c;i++){
				if(at%q[i]==0){
					t[i]++;
					at = at/q[i];
				}
			}
			if(temp==at) break;
		}
		long z = 1;
		if(at==as) z = at;
		long y = z;
		cout << z << " " << y << endl;
		for(int i=0;i<c;i++){
			y *= pow(q[i],max(s[i],t[i]));
			z *= pow(q[i],min(s[i],t[i]));
		}
		cout << z << " " << y << endl;
	}
}

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

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

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


const int GCM(const int a,const int b){
	int x(a),y(b);
	while(x%=y){
		std::swap(x,y);
	}
	return y;
}

const int LCM(const int a,const int b){
	int x(a),y(b);
	while(x%=y){
		std::swap(x,y);
	}
	long tmp(a);
	tmp*=b;
	tmp/=y;
	return tmp;
}


int main(int,char**){
	int a,b;
	while(std::cin >>a){
		std::cin >> b;
		std::cout << GCM(a,b) << ' ' << LCM(a,b)<<std::endl;
	}
	return 0;
}

C++: #include <iostream>

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

		if(a > b)
			small = b;
		else
			small = a;

		for(int i = 2; i <= small; i++){
			if(a % i == 0  &&  b % i == 0){
				maxdivi = maxdivi * i;
				i = 2;
			}
		}
		minmul = a * b / maxdivi;

	std::cout << maxdivi << minimul << std::endl;

	}

	return 0;
}

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

int GCD(int a,int b);
int LCM(int a,int b);

int main()
{
	int a,b,gcd,lcm;

	while(cin>>a>>b)
	{
		if(a==0 || b==0)
			cout<<"0 0"<<endl;
		gcd=GCD(a,b);
		lcm=LCM(a,b);
		cout<<gcd<<' '<<lcm<<endl;
	}
}

int GCD(int a,int b)
{
	while(a!=b)
		if(a>b) a=a-b;
		else    b=b-a;
	return a;
}
int LCM(int a,int b)
{
	return ((a / GCD(a, b)) * b);/*(a*GCD(a,b)*b);*/
}

//大文字を小文字に変換
/*
for(int i=0;i<inp.size();i++)
if(inp[i]>='A' && inp[i]<='Z')
inp[i]+='a'-'A';
*/

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

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

    int max = max(a,b);
    int min = min(a,b);

    int gcd = 0, lcm = 0;

    for(int i = 0; i < min; i++){
        if(max % i == 0) 
          gcd = i;
    }
    
    int j = 1;

    while(1){
      if((max * j) % min == 0){ 
        lcm = max * j; break;
      }
      else{ 
        i++;
      }
    }
    
    cout << gcd << " " << lcm << endl;
  }
}

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

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

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

C++: #include <iostream>
using namespace std;
typedef unsigned long long ull;

ull gcd(ull m, ull n) {
    ull r;
    if (m < n) swap(m,n);
    if (n == 0) return m;
    return gcd(n, m % n);
}

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

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

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

unsigned GCD(unsigned a, unsigned b)
{
    if (!b) return a;
    return GCD(b, a%b);
}

unsigned LCM(unsigned a, unsigned b)
{
    return a / GCD(b, a-b) * b;
}

int main(void)
{
    unsigned a, b;
    while (scanf("%u %u", &a, &b) != EOF) {
        if (a < b) swap(a, b);
        printf("%u %u\n", GCD(a, b), LCM(a, b));
    }

    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 <<endl;
	return 0;
}

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

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b)
{
    while( 1 )
    {
a = a % b;
if( a == 0 )return b;
b = b % a;
if( b == 0 )return a;
    }
}

return a;
}

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

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

unsigned long gcd(unsigned long a, unsigned long b) {
	if(a == 0 || b == 0) return 0;
	while(a != b) {
		if(a > b) a -= b;
		else b -= a;
	}
	return a;
}

unsigned long lcm(unsigned long a, unsigned long b) {
	if(a == 0 || b == 0) return 0;
	return (a / gcd(a, b)) * b;
}

int main() {
	unsigned long a, b;
	unsigned int arg[0xfFf][2] = { 0 };
	int cnt = 0;
	while(scanf("%d %d", &a, &b) != EOF) {
		arg[cnt][0] = a;
		arg[cnt++][1] = b;
	}
	int i;
	for(i = 0; i < cnt; i++) {
		printf("%d %d\n", gcd(arg[i][0], arg[i][1]), lcm(arg[i][0], arg[i][1]));
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
 
int main(){
long long   a,b,ta,tb;
     
    while(cin>>a>>b){
    ta=a;tb=b;
    if(a<b)swap(a,b);
    while(true){
       long long tmp=a;
        a=b;
        b=tmp-b;
        if(a-b==0)break;
    }
    cout<<b<<" "<<ta*tb/b<<endl;
    }
    return 0;
}

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

typedef long long ll;
using namespace std;

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

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

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

int gcd(int a, int b) {
    int r;
    while((r = a % b) != 0) 
    {
        a = b;
        b = r;
    }
    return b;
}

int main(void){
    int a, b, tmp;
    if (a < b){
        tmp = b;
b = a;
a = tmp;

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

C++: #include<iostream>
#include<string>
using namespace std;
int main()
{
	int a,b;
	cin>>a;
	while((getchar())!=EOF)
	{ 
		cin>>b;
		int i,G,L,temp;
		if(a>b)
		{
			temp=b;
		}
		else
		{
			temp=a;
		}
		for(i=1;i<=temp;i++)
		{
			if(a%i==0&&b%i==0)
			L=i;
		}
	    
		G=(a*b)/L;
		cout<<L<<" "<<G;
		cin>>a; 
		
	}
	return 0;
}