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

int main(void){
    long long a,b,c,d,x,ans01,ans02;
    while(std::cin >> a >> b){
        if(b > a){
           x = a;
           a = b;
           b = x;
        }
        c = a % b;
        d = b % c;
        if(d == 0) {
            ans01 = c;
            ans02 = a * b / c;
        }
        else if (c % d == 0) {
            ans01 = d;
            ans02 = a * b / d;
        }
        std::cout << ans01 << " " << ans02 << std::endl;
    }
    return 0;
}

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

int gcd( int a, int b)
{
   return b ? gcd(b,a%b):a;
}


int main()
{
    int a,b;
   while(scanf( "%d%d",&a,&b) != EOF)
    {

        cout << gcd( a,b )<< " "<< a/gcd( a,b) * b << endl;

    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
long long int a,b,gcd,lcm,tmp,r,num_a,num_b;
while(cin>>num_a>>num_b){
a=num_a;
b=num_b;
if(a<b){
tmp = a;
a = b;
b = tmp;
}
r=a%b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
gcd = b;
lcm = (num_a*num_b)/gcd;
cout<<gcd<<" "<<lcm<<endl;
}
return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int a, b;
	while (cin >> a >> b) {
		int a2 = max(a, b), b2 = min(a, b);
		while (b2 > 0) {
			int r = a2 % b2;
			a2 = b2;
			b2 = r;
		}
		cout << a2 << ' ' << a / a2 * b << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

void solve(ll a,ll b){
    ll g = gcd(a,b);
    ll l = a/g*b;
    cout << g <<  " " << l << endl;
}

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

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i;
while(cin>>a>>b){
x=a;y=b;
while(1){
  if(x<y){y=y-x;x=x-y;}
  else if(x==y){break;}
  else{x=x-y;y=y-x;}
}
L=(a*b)/x;
cout<<y<<" "<<L<<endl;
++i
if(i<=50){break;}
}
}
  return 0;
}

C++: #include<stdio.h>
int main(void) {
	long long int a, b, minans = 0, maxans = 0;
	while (scanf("%lld %lld", &a, &b) != EOF)
	{
		for (long long int i = (b / 2); i >= 2; i--)
		{
			if (a%i == 0 && b%i == 0) {
				maxans = i;
				break;
			}
		}
		for (long long int i = 1; i <= a; i++)
		{
			if ((i*b) % a == 0) {
				minans = i*b;
				break;
			}
		}
		printf("%lld %lld\n", maxans, minans);
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i;
while(cin>>a>>b){
x=a;y=b;
while(x!=y){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
}
L=(a*b)/x;
cout<<y<<" "<<L<<endl;
}
  return 0;
}

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


long long int gcd(long long int a, long long int b)
{
    long long int ret;
    
    if( a < b ){
        long long int tmp = a;
        a = b;
        b = tmp;
    }
    
    if( b == 0 ) return a;
    
    ret = a % b;
    ret = gcd(b, ret);
    
    return ret;
}


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


int main()
{
    while( 1 ){
        long long int a, b;
        if( scanf("%lld%lld", &a, &b) == EOF ) break;
        printf("%lld %lld\n", gcd(a, b), lcm(a, b));
    }

    return 0;
}

C++: #include<iostream>
int a,b,c,d,s;int e(){if(a<b)a^=b^=a^=b;return(a%=b)?e():b;}int f(){if(a<b)a^=b^=a^=b;for(;a>b;)b+=d;return a-b?f():a;}int main(){for(;s=!(std::cin>>a>>b).eof();s&&printf("%d %d\n",e(),(c=a,d=b,f())));}

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>
#include <cstdio>
using namespace std;

int gcd(int a, int b) {
  	int q,r;
	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<iostream>
using namespace std;
long long gcm(long long a, long long b){
	if(b > a){
	long long d;
	d = a;
	a = b;
	b = d;
	}	
	long long c;
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}
int main(){
	for(int i=1;i<=3;i++){
	long long c,d,e;
	std::cin>>c>>d;
	e = gcm(c,d);
	std::cout<<e<<" "<<((c/e)*(d/e)*e)<<endl;
	}
}

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

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

C++: #include<iostream>

int main(){
	long int a, b, r;
	
	while(std::cin >> a >> b){
		long int product = a*b;
		
		// GCD
		if(a < b){
			long int temp = a;
			a = b;
			b = temp;
		}
		while((r = a%b) != 0){
			a = b;
			b = r;
		}
		
		// LCM
		long int lcm = product / b;
		
		// show
		std::cout << b << ' ' << lcm << std::endl;
	}
	
	return 0;
}

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

int main(){
	int a, b;
	while(cin >> a >> b){
		int c = a, d = b, p1 = c, p2 = d;
		while(a%b != 0){
			int tmp = a;
			a = b;
			b = tmp%b;
		}
		while(c != d){
			if(c < d)
				c += p1;
			else
				d += p2;
		}
		cout << b << ' ' << c << endl;
	}
    return 0;
}

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

using namespace std;

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

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

  long long ans1 = gcd(a,b);
  cout<<ans1<<" "<<b/ans1*a<<endl;
  return 0;
}