Go: package main

import "fmt"

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

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d\n", G, L)
	}
}

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;
}

C++: #include <iostream>

typedef unsigned int ui;

void swap(ui & a, ui & b)
{
	unsigned int tmp = a;
	a = b;
	b = tmp;
}

ui gcd(ui a, ui b)
{
	if (a < b) swap(a, b);

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

	return b;
}

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

int main() {
	using namespace std;

	ui a, b;
	while (cin >> a >> b) {
		const ui GCD = gcd(a, b);
		cout << GCD << ' ' << lcm(a, b, GCD) << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair

ll gcd(ll a, ll b)
{
    while(1)
    {
        if (a == 0) return b;
        b %= a;
        if (b == 0) return a;
        a %= b;
    }
}

ll lcm(ll a, ll b)
{
    ll temp = gcd(a, b);
    return temp ? (a / temp * b) : 0;
}

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

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

int main(void){
    long long a,b,c,d,x,ans01,ans02;
    int count;
    while(std::cin >> a >> b && count <= 50){
        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;
        count ++;
    }
    return 0;
}

C++: /*
P135
AOJ 0005 GCD and LCM
*/

#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <functional>
#include <string.h>
#include <cmath>

using namespace std;

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

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

C++: #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <utility>
using namespace std;
int gcd (int a , int b){
    if(a<b)
        swap(a,b);
    return b==0 ? a:gcd(b,a%b);
}
int lcm (int a , int b){
    return a/gcd(a,b)*b;
}
int main (){
    int a = 0;
    int b = 0;
    while (scanf("%d%d",&a,&b)!=EOF&&(a>0&&b>0&&a<=2000000000&&b<=2000000000)&&lcm(a,b)<=2000000000)
        cout<<gcd(a,b)<<' '<<lcm(a,b)<<endl;
    return 0;
}

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

int gcd(int a, int b) {
   
     int 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){
   int 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 int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int inf = 1e9;

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

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

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

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

C++: #include<iostream>
#include<utility>
using namespace std;
int main()
{
  int a=0;
  int b=0;
  long int c=0;
  int n,m;
  int i,j,l;

  while(scanf("%d %d",&n,&m) != EOF)
    {
      i = n;
      j = m;

      //koyaku
      if((n >= m) != true)swap(n,m);
      while(1)
	{
	  int amari = n % m;
	  n = m;
	  m = amari;
	  if(amari == 0) break;
	}
      
      //kobai
      l = i*j/n;
      
      cout << n << " " << l << endl;
    }
}

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

int gcd(int x,int y){
  if(y==0)return x;
  return gcd(y,x%y);
}
int main(){
  int a,b;
  while(cin>>a>>b){
    int g=gcd(a,b);
    cout<<g<<' '<<a/g*b<<endl;
  }
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
 long long int a, b, c, temp, min, A, B;
 while(cin >> a >> b){
  if(a == 0){
    cout << "0" << " " << "0" << endl;
  }
  else if(b == 0){
    cout << "0" << " " << "0" << endl;
  }
  else if(a < b){
    temp = a;
    a = b;
    b = temp;
  }

    
  else if (a > b){
    A = a;
    B = b;

    while(1){
      c = A % B;
      if(c == 0) break;
      else if(c != 0){
        A = B;
        B = c;
      }
    }
    min = (a * b) / B;
    cout << B << " " << min << endl;
  }
  else if(a == b){
    cout << a << " " << a << endl;
  }

 }
 return 0; 
}

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

C++: #include <cstdio>
#include <algorithm>

using namespace std;

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

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