Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

C++: #include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<iomanip>
#include<string>
using namespace std;

int gcd(long long int m,long long int n){
	while(m!=n){
		if(m>n){m=m-n;
		}
		else n=n-m;
	}
	return m;
}
int lmc(long long int m,long long int n){
return m*n/gcd(m,n);
}

int main(){
long long int a,b;
while(cin>>a>>b){
	cout<<gcd(a,b)<<" "<<lmc(a,b)<<endl;

}


}

C++: #include <iostream>

using namespace std;

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

int gcd(int x,int y)
{int r=1,m=1;
    while (r)
    {
        if(x>y)
        {r=x=x%y;m=y;}
    else
        {r=y=y%x;m=x;}
    }
    return m;
}
int lcm(int x,int y)
{int i=1;
    while (i>=1)
    {
    if (i%x==0&&i%y==0)
        break;
    else
        i++;
    }
    return i;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
//#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 1e18;
const double PI = acos(-1);

ll gcd(ll x, ll y) {
	int r = 0;
	if (x < y) swap(x, y);

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

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


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b;
	while (cin >> a >> b) {
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
	//PAU;
	return 0;
}

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

int main()
{
	long long iNumA, iNumB, iGCD, iLCM, iGCDTemp, iGCDTempL, iLCMTempA[256], iLCMTempB[256], iCount, i, j, k;
	bool      TrueFlag;

	while( cin >> iNumA >> iNumB ){

		iGCDTempL = 0;
		iGCDTemp  = iNumB;

		while( iGCDTemp != 0 ){

			iGCDTempL = iGCDTemp;
			iGCDTemp  = iNumA % iGCDTemp;

		}

		iGCD     = iGCDTempL;
		iCount   = 1;
		i	     = 1;
		TrueFlag = false;

		while( 1 ){

			while( iCount % 11 != 0 ){

				iLCMTempA[iCount-1] = iNumA * i;
				iLCMTempB[iCount-1] = iNumB * i;
				iCount++;
				i++;

			}

			for( j = iCount - 10; j < iCount; j++ ){

				for( k = j; k < iCount; k++ ){

					if( iLCMTempA[j] == iLCMTempB[k] ){
						iLCM = iLCMTempA[j];
						TrueFlag = true;
						break;
					}

				}

				if( TrueFlag == true ) break;

			}

			if( TrueFlag == true ) break;

		}

		cout << iGCD << ' ' << iLCM << endl;

	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

ll gcd(ll x,ll y){
    if(x%y!=0) return gcd(y,x%y);
    else return y;
}

ll lcm(ll x,ll y){
    return x*y/gcd(x,y);
}

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

C++: main(){
  unsigned int i,j,a,b;
  while(scanf("%d %d",&a,&b)!=-1){
    if(a<b){
      //for(i=1;b%(a/i);for(;a%i;i++))
	//;
      for(i=a;a%i||b%i;i--);
      for(j=i;j%b;j+=i);
    }else{
      for(i=b;a%i||b%i;i--);
      for(j=i;j%a;j+=i);
    }
    printf("%d %d\n",i,j);
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    int a,b,big,small,r;

    while(1){
        cin >> a >> b;
        if(cin.eof()){
            break;
        }
        
        if(a > b){
            big = a;
            small = b;
        }
        else {
            big = b;
            small = a;
        }
        
        r = big % small;
        while(r != 0){
            big = small;
            small = r;
            r = big % small;
        }
        
    cout << small << ' ' << (a / small) * (b / small) * small << endl;
    
    }

    return 0;
}

C++: #include <iostream>
int gcd(int a, int b)
{
  while (1) {
    if (b == 0) {
      return a;
    }
    int temp = b;
    b = a % b;
    a = temp;
  }
}

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

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

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

using namespace std;

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

int main()
{
    while(x != -1)
{
   int a, b;
   cin >> a >> b;
   cout << rez(a, b) << (a*b)/rez(a, b) << endl;
}


}

C++: #include <cstdio>

using namespace std;

#define max( x, y ) ( ( x > y ) ? x : y )
#define min( x, y ) ( ( x < y ) ? x : y )

int main()
{
	char buf[1024];
	int a, b;

	while ( fgets( buf, sizeof( buf ) - 1, stdin ) != NULL && buf[0] != '\n' )
	{
		sscanf( buf, "%d %d", &a, &b );

		for ( int i = min( a, b ); 1 < i; i-- )
		{
			if ( !( a % i ) && !( b % i ) )
			{
				printf("%d ", i );
				break;
			}
		}

		for ( int i = min( a, b ) * 2; i <= 2000000000; i++ )
		{
			if ( !( i % a ) && !( i % b ) )
			{
				printf("%d\n", i );
				break;
			}
		}
	}

	return 0;
}

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

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

C++: #include <iostream>

using namespace std;

long gcd(long a, long b)
{
  long m, n;
  if (a > b) {
    m = a;
    n = b;
  } else {
    m = b;
    n = a;
  }

  long tmp;
  while (n != 0) {
    tmp = n;
    n = m % n;
    m = tmp;
  }

  return m;
}

long lcm(long a, long b, long _gcd = -1)
{
  if (_gcd == -1) {
    _gcd = gcd(a, b);
  }
  
  return a * (b / _gcd);
}

int main(int argc, char const* argv[])
{
  long a, b, _gcd, _lcd;
  while (cin >> a >> b) {
    _gcd = gcd(a, b);
    _lcd = lcm(a, b, _gcd);
    cout << _gcd << " " << _lcd << endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
long  yaku,bai,a,b;
long long  fe;

int GCD(int x,int y){
  if(y==0){
    return x;
  }
  else{    
    return GCD(y,x%y);
  }
}
int main(){
  for(;cin>>a;){
    cin>>b;
    if(a>b){
      yaku=GCD(a,b);
    }
    else{
      yaku=GCD(b,a);
    }
    fe = a*b;
    cout<<yaku<<" "<<fe/yaku<<endl;
  }
}

C++: #include<cstdio>

int main(){
	long long a,b,g,l,t;
	while(scanf("%lld %lld", &a, &b) + 1){
		if(a > b){
			t = a;
			a = b;
			b = t;
		}

		if(b % a){
			t = a / 2;
			l = 1;
			for(int i = 2; i <= t; i++){
				if(!(a % i)){
					g = a / i;
					if(!(b % g)){
						printf("%lld %lld\n", g, a * b / g);
						i += t;
						l = 0;
					}
				}
			}
			if(l){
				printf("1 %lld\n", a * b);
			}

		}else{
			printf("%lld %lld\n", a, b);
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	unsigned long long a,b,c;
	while(cin>>a>>b){
		c=a*b;
		if(a==b){
			cout<<a<<" "<<b<<endl;
		}else{
			while(!(a==0 || b==0)){
				if(a>b){
					a-=b;
				}else{
					b-=a;
				}
			}
			cout<<((a==0)?b:a)<<" "<<c/((a==0)?b:a)<<endl;
		}
	}
	return 0;
}