Go: package main

import "fmt"

func main() {
	var a, b int
	var gcd, lcm int

	for {
		_, err := fmt.Scanf("%d %d", &a, &b)
		if err != nil {
			return
		}

		var big, small int
		// GCD
		if a > b {
			big = a
			small = b
		} else {
			big = b
			small = a
		}

		for {
			if big%small == 0 {
				gcd = small
				break
			} else {
				small, big = big%small, small
			}
		}

		// LCM
		lcm = a * b / gcd

		fmt.Println(gcd, lcm)
	}
}

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

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    //gcd = u(a, b);
   lcm = l(a, b);
//printf("%d %d\n",gcd, lcm);
    //std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0){return i;}
      else{i++;}
    }else{
      i++;
    }
  }
}

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

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

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

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

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

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

int main() {
	int a,b,c,e,f;
	while(cin>>a>>b){
		long long g=0,l=0;
		e=a;
		f=b;
		if(e>f){
			e=e-f;
		}
	    if(f>e){
	    	f=f-e;
	    }
	    if(f==e){
	    	l=e;
	    }
	    if(l!=0) break;
		cout<<l<<" "<<a*b/l<<endl;
	    }
	return 0;
}

C++: #include<bits/stdc++.h>

#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define ALL(obj) (obj).begin(),(obj).end()
#define space <<" "<<
using namespace std;

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

    lcm=a*b;

    while(b!=0){
    gcd=a%b;
    a=b;
    b=gcd;
    }

    cout<<a space lcm/a <<endl;
    }
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b,s,m,ta,tb,tmp;
	while(cin>>a>>b){
	ta=a,tb=b;
	s=0,m=0;
	if(a<b)swap(a,b);
	
	while(true){
		tmp=a;
		a=b;
		b=tmp%a;
		if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
	}
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
}

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

int main(){
  int a,b,ky,kb,t,k;

  for(int n=0;n<50;n++){
    cin>>a;
    cin>>b;
    t=1;
    for(int i=1;i<2000000;i++){
      if(a%i==0&&b%i==0){
        a=a/i;
        b=b/i;
        t=i*t;
      }
    }
    k=t*a*b;
    cout<<t<<" "<<k;
  }
  return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


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

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

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

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

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <stdio.h>
using namespace std;
int gcd(int x,int y){
    if(x<y)swap(x,y);
    int r=1;
    while (r) {
        r=x%y;
        x=y;
        y=r;
    }
    return x;
    
}
int main() {
    int a,b;
    while (cin >> a >> b) {
        cout << gcd(a,b)<< " "<<a*b/gcd(a, b)<<endl;
    }
}

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

int gcd(int x,int y){
  if(x%y==0) return y;
  else{
    int z=x%y;
    return gcd(y,z);
  }
}

int main()
{
  int a,b;
  int g;
  long int l;
  while(cin >> a >> b){
  
    if(a>b) g=gcd(a,b);
    else if(a<b) g=gcd(b,a);
    else g=a;

    l=a*b/g;
    cout << g << " " << l << " " << endl;
  }

  return 0;
}

C++: #include <cstdio>

using namespace std;

#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 = 1; i * a <= 2000000000; i++ )
		{
			if ( !( i * a % b ) )
			{
				printf("%ld\n", i * a );
				break;
			}
		}
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

// プロトタイプ宣言
int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i<j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	
	if(j == 0){
		return i;
	}else{
		return gcd(j, i%j);
	}
	
}

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 int long long
using namespace std;
 
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
    }
signed main(){
 int a,b;
 while(cin>>a>>b){
     int c=gcd(a,b);
     printf("%lld %lld\n",c,a*b/c);
     }
}

C++: #include <bits/stdc++.h>

using namespace std;

template<typename T> T gcd(T a, T b) {
  return __gcd(a, b);
}

template<typename T> T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}

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