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<stdio.h>
using namespace std;

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

int main()
{
    int min,max,a,b;
    while(scanf("%d %d",&a,&b)!=EOF)
    {
    max = gcd(a,b);
    min = (a/max)*(b/max)*max;
    cout << max << " " << min<<endl;
    }
    return 0;
}

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

long long a, b, g;

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

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

C++: #include <iostream>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <sstream>
using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long

int main()
{
	int a, b;
	while (cin >> a >> b)
	{
		if (a < b) swap(a, b);
		int A = a; int B = b;
		while (1)
		{
			a -= (a / b)*b;
			if (a == 0) break;
			swap(a, b);
		}
		cout << b << " " << A / b*B << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  long long int a,b;
  while(cin>>a>>b){
    cout<<__gcd(a,b)<<" "<<a*(b/__gcd(a,b))<<endl;
  }


}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main() {
  long long 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 a, int b)
{
    if(a % b == 0) { return b; }
 
    if(b % a == 0) { return a; }
 
    if(a > b) { return GCD(a % b, b); }
 
    if(a < b) { return GCD(a, b % a); }
}
 
 
int main()
{
    int a, b;
 
    while(cin >> a >> b)
    {
int n=GCD(a,b);
        cout << n << ' ' << a/n*b << endl;
    }
 
    return 0;
}

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

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

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

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

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

int LCM(int m, int n){
  return m/GCD(m, n)*n;
}

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

C++: #include <stdio.h>

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

while(scanf("%d %d",&a,&b) != EOF){
aa=a;
bb=b;
while(a%b!=0){
x=a%b;
a=b;
b=x;
}
for(i=1;i<=aa*bb;i++){
if(i%aa==0 && i%bb==0){
y=i;
break;
}
}
printf("%d %d\n",b,y);
}
return 0;
}

C++: #include<stdio.h>
int gcd(int x, int y);
int lcm(int x, int y, int g);
int main(){
    int g,l,x,y;
    while (scanf("%d%d",&x,&y) != EOF){
        g=gcd(x,y);
        l=lcm(x,y,g);
        printf("%d %d\n",g,l);
    }
    return 0;
}
int gcd(int x, int y){
    int a,b,c,GCD;
    if(x > y){
        a=x;
        b=y;
        for(;;){
            c = a % b;
            if(a % b == 0){
                GCD=b;
                break;
            }
            a=b;
            b=c;
        }
    }
    else if(x < y){
        a=y;
        b=x;
        for(;;){
            c = a % b;
            if(a % b == 0){
                GCD=b;
                break;
            }
            a=b;
            b=c;
        }
    }
    else if(x == y) GCD=x;
        return GCD;
}
int lcm(int x, int y, int g){
    return (x/g)*(y/g)*g;
}

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

int solve(int a, int b){
    int r;
    r = a % b;

    if(r == 0){
        return b;
    }else{
        return solve(b, r);
    }
}

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

    while(cin >> a >> b){
        gcd = solve(a, b);
        lcm = a / gcd * b;

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

    return 0;
}

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>

using namespace std;

void gcd_lcm(int, int);

int main() {

	int a, b;

	while(cin >> a >> b) {
		gcd_lcm(a, b);
	}

}

void gcd_lcm(int a, int b) {
	int i=2, gcd=1;
	if(a<b) {
		int t=a;
		a=b;
		b=t;
	}

	while(i<=a) {
		if(a%i==0&&b%i==0) {
			gcd*=i;
			a/=i;
			b/=i;
			continue;
		}
		i++;
	}
	
	cout << gcd << " " << a*b*gcd << endl;
}

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

using namespace std;

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

}

C++: #include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
using namespace std;

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

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

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

int main(){
//	m*n = LCM * GCD
	unsigned long long m, n;
	while(cin >> m >> n){
		int LCM, GCD;
		
		if(m<n){
			int swap;
			swap = m;
			m = n;
			n = swap;
		}

		int m_, n_;
		m_ = m;
		n_ = n;
		do {
			if(n_==0){
				GCD = m_;
				break;
			}
			
			int swap = m_ % n_;
			m_ = n_;
			n_ = swap;
		} while(1);
		
		LCM = (m*n)/GCD;
		cout << GCD << " " << LCM << endl;
	}

	return 0;
}

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

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

int main(){
	int a,b,g,l;
	while(cin>>a>>b){
		g=gcd((a>=b)?a:b,(a>=b)?b:a);
		l=(a/g)*b;
		cout<<g<<" "<<l<<endl;
	}
	return 0;
}

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

using namespace std;

int GCD(int a, int b){
	if(a < b){
		swap(a, b);
	}
	while(b){
		a %= b;
		swap(a, b);
	}
	return a;
}

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<stdio.h>
int main(){
  long long int r,temp,x,y;
  while(scanf("%lld",&x)!=EOF){
    scanf("%lld",&y);
    if(x<y){
      temp=x;
      x=y;
      y=temp;
    }
    long long int a=x;
    long long int b=y;
    while(y!=0){
      r=x%y;
      x=y;
      y=r;
    }
    long long int lcm=a*b/x;
    printf("%lld %lld\n",x,lcm);
  }
  return(0);
}