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 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<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pi acos(-1)
#define inf 0x3f3f3f3f
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define rep(i,x,n) for(int i=x;i<n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
using namespace std;
typedef pair<int,int>P;
const int MAXN=100010;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int main()
{
	ll a, b;
	while(cin >> a >> b)
	{
		ll c = __gcd(a, b);
		cout << c << " " << a / c * b << endl;
	}
 	return 0;
}

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

int main(){
    unsigned int a,b,c;
    cin>>a>>b;
    int g,l,p;
    p=a*b;
    while(b!=0){
        c=b;
        b=a%b;
        a=c;
    }
    g=a;
    l=p/g;
    cout<<g<<" "<<l<<endl;
    return(0);
}

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

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

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

C++: #include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int gcd(int a,int b){
	while(b){
		int t=a%b;
		a=b;
		b=t;
	}
	return a;
}
int main() {
	int a,b;
	while(cin >> a >> b){
		int g=gcd(a,b);
		cout << g << " " << a/g*b << endl;
	}
}

C++: #include<iostream>

using namespace std;

int main(){
    long a, b;
    cin>> a >> b;
    long A=a, B=b;
    while (a!=b)
    {
        if (a > b){
            a = a - b;
        }
        else{
            b = b - a;
        }
    }
    long gcd = A / a*B;
    cout << a << " " << gcd;

    return 0;
}

C++: #include <iostream>

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

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

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

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


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

C++: #include <cstdio>
#include <cstring>
#include <queue>
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
#define LL long long
const int N = 50005;
LL x,y;
LL gcd(LL a, LL b){
    return (b==0?a:gcd(b,a%b));
}
void init(){
}
void solve(){
}
int main(){
    while(cin>>x>>y){
        LL g = gcd(x,y);
        cout<<g<<" "<<x/g*y<<endl;
    }
    return 0;
}

C++: #include <iostream>
int Gcd(int a, int b) // Greatest Common Divisor
{
    if (!a || !b) {
        return 0;
    }
    while (a != b) {
        if (a > b) {
            a -= b;
        } else {
            b -= a;
        }
    }
    return a;
}
int Lcm(int a, int b, int gcd) // Least Common Multiple
{
    if (!a || !b) {
        return 0;
    }
    return (a * b)/gcd;
}
int main()
{
    int a, b, gcd;
    while (std::cin >> a >> b) {
        gcd = Gcd(a, b);
        std::cout << gcd << " " << Lcm(a, b, gcd) << "\n";
    }
}

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

int main() {
	// your code goes here
	long long int a,b;
	long long int miner,maxer;
	while(cin >> a >> b){
		int a2=a,b2=b;
		while(max(a2,b2)%min(a2,b2)!=0){
			if(a2>b2)
			a2=a2-b2;
			else
			b2=b2-a2;
		}
		miner =min(a2,b2);
		cout << miner << " " ;
		cout << a/miner*b << endl;
	}
	return 0;
}

C++: #include <stdio.h>
int gcd(int a, int b);
int main()
{
    long long a, b,g, lcd;
    while(scanf("%lld %lld",&a, &b)==2)
    {
    g =gcd(a,b);
    lcd= (a*b)/g;
    printf("%lld %lld\n", g, lcd);
    }
    return 0;
}
int gcd(int x, int y)
{
    int r;
    while(x!=0)
    {
        r=y%x;
        y=x;
        x=r;
        gcd(x,y);
    }


    return y;
}

C++: #include<cstdio>

using namespace std;

int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a-(a/b)*b);
}

int main(){
	int a,b;
	int g,l;
	int tmp;
	if ( ! (scanf("%d %d",&a,&b) == EOF) ){
		g = gcd(a,b);
		l = a/g*b;
		printf("%d %d",g,l);
	}
}

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

int gcd(int a, int b){
  return (b>0)? gcd(b,a%b) : 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;
  }
}

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

int main(){
	int a = 0;
	int b = 0;
	int max = 0;
	int min = 0;
	int d = 1;
	int a_bk = 0;
	int b_bk = 0;

	while (cin >> a >> b) {
		if (a > b) {
			max = b;
			min = a;
		}
		else {
			max = a;
			min = b;
		}

		a_bk = a;
		b_bk = b;
		d = 1;

		for (int c = 2; c <= max ; c++) {
			while(a%c == 0 && b%c == 0) {
				a /= c;
				b /= c;
				d *= c;
				
			}
		}
		cout << d << "\n";

		a = a_bk;
		b = b_bk;

		for (min; min <= 2000000000; min++) {
			if (min%a == 0 && min%b == 0) {
				cout << min << "\n";
				break;
			}
		}
	}


	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
	int n = 45000;
	int p[n];
	for(int i=0;i<n;i++) p[i] = 0;
	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],s[c];
		for(int i=0;i<c;i++) t[i] = 0;
		for(int i=0;i<c;i++) s[i] = 0;
		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<cstdio>
#define LL long long
LL gcd(LL a,LL b)
{
	if(!b) return a;
	return gcd(b,a%b);
}
int main()
{
	LL a,b,g;
	while(~scanf("%lld%lld",&a,&b))
	{
		g=gcd(a,b);
		a*=b;
		printf("%lld %lld\n",g,a/g);
	}
}