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 <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<((x))<<endl
#define fi first
#define se second

#define INF 2147483600

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

  return 0;
}

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

using namespace std;

////Nayeem Shahriar Joy,Applied Physics &Electronic Engineering,University of Rajshahi.

int gcd(long long int a,long long int b)
{
    long long int c;
    while(a%b!=0)
    {
        c=a%b;
        a=b;
        b=c;
    }
    return b;
}

int main()

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

C++: #include<stdio.h>

int main(void)
{
	int x[1000],x2[1000],y[1000],y2[1000],z[1000],w[1000],t[1000],i=0,j=0;

	while(i!=-1)
	{
		scanf("%d %d",&x[i],&y[i]);		   
		x2[i] = x[i];
		y2[i] = y[i];
		if(x[i]<=0 || x[i]>2000000000 || y[i]<=0 || y[i]>2000000000)break;
		i=i+1;
	}
	for(j=0;j<i;j++)
	{
	   while(x[j] % y[j] !=0)
	   {
     	  z[j] = x[j] % y[j];
 		  x[j] = y[j];
 		  y[j] = z[j];
	   }
	   w[j] = x2[j] * y2[j] / y[j];
	   if(w[j]<=2000000000)
	   printf("%d %d\n",y[j],w[j]);
	}
  return 0;
}

C++: #include <stdio.h>
    
int main(){
     
    int buf1[50],buf2[50];
     
    int k = 0;
    while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++;
     
    for( int i = 0;i < k;i++ ){
        int b1 = buf1[i],b2 = buf2[i];
        int m,n;
        if( b1< b2 ){
            m = b2,n = b1;
        } else if( b1 > b2 ){
            m =  b1,n = b2;
        } else {
            n = 0;
            m = b1;
        }
          
        while( n != 0 ){
            int buf = n;
            n = m % n;
            m = buf;
        }
        printf( "%d ",m );
  
        while( b1 != b2 ){
            if( b1 < b2 ) b1 += buf1[i];
            else             b2 += buf2[i];
        }
        printf( "%d\n",b1 );
    }
    return 0;
}

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

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

int main(){
	int a, b, c, d;

	while(cin >> a >> b){
		c=gcd(a, b);
		d=lcm(a, b);

		cout << a << " " << b << endl;
	}

	return 0;
}

int gcd(int a, int b){
	int d, e, f;

	if(a>=b){ d=a; e=b; }
	else { d=b; e=a; }
	f=e;
	while(1){
		if(d%f==0) return f;
		f=d % e;
		d=e;
		e=f;
	}
}

int lcm(int a, int b){
	int c=gcd(a,b);
	int d;
	d=a;
	d /= c;
	d *= b;
	return d;
}

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

int main() {
    int a, b;
    while (cin >> a >> b) {
        if (a > b) swap(a, b);
        int A = a, B = b;
        while ((a % A != 0) || (b % A != 0)) {
            --A;
        }
        while ((B % a != 0) || (B % b != 0)) {
            B += A;
        }
        cout << A << ' ' << B << endl;
    }
    
    return 0;
}

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

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

C++: //কী পেয়েছো তুমি, কী চেয়েছিলে তুমি.? হিসেবটা তোমার বড়ই গড়মিল...!!//
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3F3F3F3F
typedef long long ll;
vector<ll>v;

int main ()
{
    ll n,m;
    while(scanf("%lld%lld",&n,&m)!=EOF){
        cout<<__gcd(n,m)<<" "<<(n*m)/__gcd(n,m)<<endl;
    }
}
/*
5 6
1 0
0 5
1 2
1 3
2 3
3 4
*/

C++: #include<iostream>
using namespace std;
typedef long long int ll;

ll GCD(ll,ll);
ll a, b, gcd, lcm, temp;

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

ll GCD(ll a, ll b){
	if(a % b == 0)
		return (b);
	else
		return (GCD(b, a%b));
}

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

int LCG(int x, int y);

int main(){
 int a,b;
 int g;
 long l;
 while(cin >> a >> b){
    g = LCG(a,b);
    l = (long)a*b/g;
    cout << g << " " << l << endl;
 }
}

int LCG(int x, int y){
    int m = x%y;
    if(m == 0){
        return y;
    }
    LCG(y,m);
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int *a, *b, s, t;
	int p, q;
	a = &p;
	b = &q;
	while(cin >> p >> q){
		for(int i = (*a > *b)? *b : *a; i >= 1; i--){
			if(*b%i == 0 && *a%i == 0){
				cout << i << " ";
				break;
			}
		}
		s = *a;
		t = *b;
		while(s != t){
			if(s > t){
				while(s > t){
					t += *b;
				}
			} else {
				while(t > s){
					s += *a;
				}
			}
		}
		cout << s << endl;
	}
	
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
??
int main() {
????????int n, m;
????????while (2 == scanf("%d%d", &n, &m)) {
????????????????printf("%d %d\n", __gcd(n, m), n / __gcd(n, m) * m);
????????}
????????return 0;
}

C++: #include <cstdio>

using namespace std;

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

int main(){
    int a, b,gcd;
    long int lcm;
    while(true){
        scanf("%d%d",&a,&b);
        gcd = gcdr(a,b);
        //printf("%d\n",gcd);
        lcm = (long)gcd * a / gcd * b / gcd;
        printf("%d %ld\n",gcd,lcm);
    }
    
    return 0;
}

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

typedef long long int Long;

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

int lcm(Long t, Long ab) {
  return ab / t;
}

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

C++: #include <iostream>

using namespace std;

int gcd(int x, int y)
{
	return y > 0 ? gcd(y, x % y) : x;
}

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

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

const long long zero = 0LL;
long long lcm, gcd;
long long GCD(long long,long long);

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

long long GCD(long long a,long long b){
	if( b==zero ) return a;
	return GCD( b , (a%b) );
}

C++: #include<stdio.h>
long long int x,y;
long long int m,n;
long long int ans1,ans2;

int GCD(long long int n,long long int m){
    if(n%m==0){
        return m;
    }
    return GCD(m,n%m);
}

int main(){
    while(1){
        if(scanf("%lld",&n)==-1)break;
        scanf("%lld",&m);
        if(n<=m){
            ans1=GCD(m,n);
        }
        else{
            ans1=GCD(n,m);
        }
        ans2=m*n/ans1;
        printf("%lld %lld\n",ans1,ans2);
    }
    return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
	double a, b, c, d;
	while(1) {
		cin >> a >> b;
		c = a;
		d = b;
		while (1) {
			if (fmod(max(a, b), min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a -= b;
			}else b -=a;
		}
			cout << " " << c * d / a << endl;
	}

	return 0;
}