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<vector>
using namespace std;

int gcd(unsigned long int m,unsigned long int n) {
	if (n == 0)return m;
	while (m%n != 0) {
		m = m%n;
		swap(m, n);
	}
	return n;
}

int main() {
	unsigned long int a, b; vector<unsigned long int> GCDS; vector<unsigned long int> LCMS;
	while(cin>>a>>b) {
		GCDS.push_back(gcd(a, b));
		LCMS.push_back(a / gcd(a, b)*b);
	}
	for (int i = 0; i < GCDS.size(); i++) {
		cout << GCDS[i] << ' ' << LCMS[i] << endl;
	}
}

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

long long int gcd(long long int a, long long int b){
	long long int tmp;
	if(b>a) {tmp=b;b=a;a=tmp;}

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

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

C++: #include<iostream>
#include<string>
#include <algorithm>
#include<iomanip>
#include<cmath>
using std::cin; using std::string;
using std::cout; using std::endl;
using std::sort;
#define rep(X,Y) for(int (X)=0;(X)<(Y);++(X))
#define rept(X,Y,Z) for(int (X)=(Y);(X)<(Z);++(X))
#define repr(X,Y) for(int (X)=(Y);(X)>=0;--(X))
const double pi=3.141592653589793283462;
int main(){
    int a,b;
	 int gcd;
	 int lcm=0;
	while(cin>>a>>b){
	    for(int i=1;i<=b;i++){
		    if(a%i==0 && b%i==0)
			    gcd=i;
	        }
	    lcm=(a/gcd)*(b/gcd)*gcd;
	    cout<<gcd<<" "<<lcm<<endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define repp(i,n) for(int i=1; i<n; i++)
#define int long long
using namespace std;
int gcd(int a, int b)
{
    if (a % b == 0) return b;
    return gcd(b, a % b);
}
signed main(){
  int n,m;
  while(cin >> n >> m){
    int a = gcd(n,m);
    int b = n*m/a;
    cout << a << " " << b << endl;
  }
  return 0;
}

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

int main()
{
	long int a,b,i,k;

	while(cin>>a>>b){
		long int x=1, y=0;	//x最大公約数 y最小公倍数
		long int large ,small;

		//最小公倍数を求める処理
		if(a<b){small=a; large=b;}
		else{small=b; large=a;}
		for(i=large ;y==0 ;i+=large){
			if(i%small==0) y=i;
		}
		
		//最大公約数を求める処理
		long int ans[100];
		i=2; k=0;
		while(a>i && b>i){
			if(a%i==0 && b%i==0){
				ans[k]=i;
				a/=i; b/=i;
				k++;
			}else{
				i++;
			}
		}
		for(i=0 ;i<k ;i++) x*=ans[i];

		cout<<x<<" "<<y<<endl;
	}
}

C++: // B.cpp

#include <iostream>

using namespace std;

int gcd(int, int);
int lcm(int, int);

int main(void) {
	int a, b;
	cin >> a >> b; 
	cout << gcd(a, b) << " " <<  lcm(a, b) << endl;

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a =< b){
		max = b, min = a;
	}
	if(min == 0) return max;
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

C++: #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b){
	int r;
	r = a % b;
	if(r==0)
		return b;
	else
		return gcd(b,r);
}
int main(){
	int a,b;
	while(cin >> a >> b){
		int result = gcd(a,b);
		int lcm = a*(b/result);
		cout << result << " " << lcm << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(void){
    long long a, b;
    while(cin >> a >> b){
        long long _a = a, _b = b;
        long long gcd, lcm;

        while(a%b != 0){
            gcd = a%b;
            a = b;
            b = gcd;
        }
        lcm = (_a * _b)/gcd;
        cout << gcd << ' ' << lcm << endl;
    }
}

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

int gcd(int x, int y)
{
	if (x == 0 | y == 0) return 0;
	
	while (x != y) {
		if (x > y) x -= y;
		else y -= x;
	}
	
	return x;
}

int lcm(int x, int y)
{
	if (x == 0 | y == 0) return 0;
	
	return x / gcd(x, y) * y;
}

int main()
{	
	int x, y;
	
	while(cin >> x >> y) 
		cout << gcd(x, y) << " " << lcm(x, y) << endl;
	
	return 0;
}

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 / gcd(a,b)*a;   
            cout << gcd(a,b) << " " << lcm << endl;    
            
        }   
return 0;
    
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
#include <complex>
#include <cstring>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

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

C++: #include<iostream>
#include<stdio.h>

using namespace std;

int max(int x, int y){
        int r;

        while((r = x % y) != 0){
                x = y;
                y = r;
        }
        return y;
}

long long int small(int x, int y, int r){
        if(x * y % r  == 0)
                return x * y / r;
        else
                return (long long int)x * y;
}       

int main(){
        int x,y,r;

        while((scanf("%ld %ld",&x,&y)) != EOF){
                if(x < y){
                        int num = y;
                        y = x;
                        x = num;
                } 
                cout << max(x,y) << " " << small(x,y,max(x,y)) << endl;
        }
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int Gcd(int a,int b){
    int r=-1;
    int temp;
    if(a<b){
        temp = a;
        a = b;
        b = temp;
    }
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}

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


    while(cin>>a>>b){
        gcd = Gcd(a,b);
        a=a/gcd;
        b=b/gcd;

        printf("%d %d\n",gcd,gcd*a*b);
    }

    return 0;
}

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

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

int main()
{
    int a,b,n=0;
    while(cin >> a >> b){
        if (a>b) {
            n = b;
            while (a % b != 0) {
                b = a % b;
            }
            cout << b << " " << a*n/b << endl;
        }
        
        if (b>a) {
            n = a;
            while (b % a != 0) {
                a = b % a;
            }
            cout << a << " " << b*n/a << endl;
        }

    }
}