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 <stdio.h>

int main(void) {
	int buf,i,c;
	long int a,b,gcd,lcm;
	
	while(scanf("%ld%ld",&a,&b) != EOF){
		if(b > a){buf = a;a = b;b = buf;}
		for(i = 1;;i++){
			if(b%(a/i) == 0) {gcd = a/i;break;}
		}
		for(i = 1; ;i++){
			if((a*i)%b == 0) {lcm = a*i;break;}
		}
		
		printf("%ld %ld\n",gcd,lcm);
	}
	
	return 0;
}

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

int solvegcd(int m,int n)
{
	if(n==0){return m;}
	if(m%n==0){return n;}
	else{solvegcd(n,m%n);}
}
int solvelcm(int m,int n)
{
	int mm,nn;
	mm = m/solvegcd(m,n);
	nn = n/solvegcd(m,n);
	return mm*nn*solvegcd(m,n);
}

int main()
{
	int a,b;
	while(cin >> a && cin >> b){
		if(a != max(a,b)){
			int tmp = b;
			b = a;
			a = tmp;
		}
		cout << solvegcd(a,b) << " " << solvelcm(a,b) << endl;
	}
	return 0;
}

C++:  #include <stdio.h>

 long long int n,m,ans,amari,ahokusa;

 int main()
 {
     scanf("%lld%lld",&n,&m);
     ans  = n*m;
     if(n < m)
     {
         ahokusa = n;
         n = m;
         m = ahokusa;
     }
     amari = n % m;
     while(amari != 0)
     {
        n = m;
        m = amari;
        amari = n % m;
     }
     ans = ans / m;

     printf("%lld %lld\n",m,ans);
     return 0;

 }

C++: #include<stdio.h>
int main(void)
{
	int x,y,temp,X,xx,yy,sb;
	while(scanf("%d %d",&x,&y)!=EOF){
		xx=x; yy=y;
		if(x<=y){
			temp=x;
			x=y;
			y=temp;
		}
		while(1){
			if(y==0)break;
			X=x%y;
			x=y;
			y=X;
		}
		sb=(xx/x)*(yy/x)*x;
		printf("%d %d\n",x,sb);
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int calc(int m,int n){

	if(n==0){
		return m;
	}
	else{
		return calc(n,m%n);
	}

}

int main(){

	int m,n;

	int kouyakusu;
	long long int koubaisu;

	while(cin>>m){
		cin>>n;

		if(m>=n){
			kouyakusu = calc(m,n);
		}
		else{
			kouyakusu = calc(n,m);
		}

		koubaisu = (m/kouyakusu)*n;

		printf("%d %lld\n",kouyakusu,koubaisu);

	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
	unsigned long long a,b,c,d,maxx=0,minn=0;
	while (cin>>a>>b){
		if (a>b){
			d=a%b;
			if (d==0) maxx=b;
			else{
				maxx=b%d;
				if (maxx==0)maxx=d;
			}
		}
		else {
			d=b%a;
			if (d==0) maxx=a;
			else{
				maxx=a%d;
				if (maxx==0)maxx=d;
			}
		}
		cout<<maxx<<" "<<a*b/maxx<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
#define LL long long
LL gcd(LL a,LL b){
    LL t;
    while(a%b){
        t = a;
        a = b;
        b = t%b;
    }
    return b;
}
int main() {
    LL a,b;
    while(cin>>a>>b){
        LL G = gcd(a,b);
        LL L = a/G * b;
        cout<<G<<" "<<L<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    long long i,a,b,c;
    while(cin>>a>>b){
        if(a<b){
            i=b-a;
        }
        else{
            i=a-b;
        }
    for( long long 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(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main() {
	long long a, b;

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

C++: #include <iostream>

using namespace std;

int main()
{
    long long a, b;
    long long big_n, small_n, mod;
    long long GCD, LCM;

    while (cin >> a >> b)
    {
        if (a > b)
        {
            big_n = a;
            small_n = b;
        }
        else
        {
            big_n = b;
            small_n = a;
        }

        while ((mod = big_n % small_n) != 0)
        {
            big_n = small_n;
            small_n = mod;
        }

        GCD = small_n;
        LCM = (a * b) / GCD;

        cout << GCD << " " << LCM << endl;
    }

    return 0;
}

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

int main(){
   int a, b, tmp, m=0, s=0;
   while(cin >> a >> b){
      if(a<b){
         tmp=a;
         a=b;
         b=tmp;
      }
      while(1){
         if(a%b==0) m=b;
         else{
            a=a-b;
            tmp=a;
            a=b;
            b=tmp;
         }
      }
      s=a*b/m;
      cout<< m << " " << s << endl;
   }
   return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main(){
	long long int x,y;
	long long int i,j;
	while(scanf("%lld%lld",&i,&j),i){
		x=i,y=j;
		while((i!=0)&&(j!=0)){
			if(i>j){
				i=i%j;
			}else{
				j=j%i;
			}
		}
		if(i==0){
			y=x*y/j;
			x=j;
		}else{
			y=x*y/i;
			x=i;
		}
		printf("%lld %lld\n",x,y);
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
  
using namespace std;
  
int gcd(int a, int b){
    if(a%b==0) return b;
    return gcd(b, a%b);
}
  
unsigned long long lcm(int a, int b){
    return (a*b/gcd(a, b));
}
  
int a, b;
int main(){
    while(cin>> a>> b){
        if(a<b) swap(a, b);
        printf("%d %llu\n", gcd(a, b), lcm(a, b));
    }
}

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

unsigned long gcd(unsigned long a, unsigned long b){
	unsigned long q;
	while(q = a % b){
		a = b;
		b = q;
	}
	return b;
}

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

int main(){
	unsigned long a, b;
	while(scanf("%ld %ld", &a, &b)){
		printf("%ld %ld", gcd(a, b), lcm(a, b));
	}

	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
	while(cin)
	{
		lld a,b;
		cin >> a >> b;
		lld n = min(a,b);
		lld m = max(a,b);
		lld gcd = 1;
		for(int i = 1; i <= n; i++)
		{
			if (n % i == 0 && m % i == 0)
			{
				gcd = i;
			}
		}
		cout << gcd << endl;
		cout << n * m / gcd << endl;
	}


	return 0;
}

C++: #include <cstdio>

unsigned long getGCD(unsigned long a, unsigned long b)
{
        if (!b) {
                return a;
        }

        return getGCD(b, a % b);
}

int main()
{
        unsigned long a, b;

        while (scanf("%lu %lu", &a, &b)) {
                unsigned long max = (a > b) ? a : b,
                                          min = (a < b) ? a : b;
                unsigned long gcd = getGCD(max, min);
                unsigned long lcm = a * b / gcd;
                printf("%lu %lu\n", gcd, lcm);
        }

        return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
    int a,b, s;
    while(scanf("%d%d", &a, &b)!=EOF){
        s=__gcd(a, b);
        printf("%d %d\n", s, (a/s)*b);              
                        
    }  
    return 0;
}

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

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

int main()
{
	while(true){
		int a, b;
		cin >> a >> b;
		if(cin.eof()) break;
		int GCD = GetGCD(a, b);
		int LCM = a * (b / GCD);
		cout << GCD << ' ' << LCM << endl;
	}
	return 0;
}

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

using namespace std;

int main(){

    long long int a,b;

    while(scanf("%lld%lld", &a, &b)!=EOF){
        printf("%lld %lld\n",__gcd(a,b),a*b/__gcd(a,b));
    }

    return 0;
}