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 <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <iomanip>


using namespace std;


int main(void) {
	int a, b;
	while(cin >> a >> b){
	int gcd = 1, lcm = a * b;
	if(a < b){
		a ^= b;
		b ^= a;
		a ^= b;
	}
	for(int i = 1;;i++){
		if(a * i % b == 0){
			lcm = a * i;
			break;
		}
	}
	for(int i = 2; i <= b; i++){
		if(a % i == 0 && b % i == 0){
			gcd *= i;
			a /= i;
			b /= i;
		}
	}
	
	cout << gcd << " " << lcm << endl;
	}
}

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

C++: #include <bits/stdc++.h>
using namespace std;

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

C++: //"push hoge"と言われたらhogeを最後に入れ、"pop"と言われたら最後尾を取りだす。"quit"で終わり。
#include<iostream>
using namespace std;

int main(){
	int a,b,hoge = 0,j=0;
	int gcd,gcds,lcm,lcms;

	while(cin >> a >> b){
		//最大公約数
		if(a > b){
			lcm = b;
			lcms = a;
		}else{
			lcm = a;
			lcms = b;
		}
		for(int i=1;i<=lcm;i++)
			if(!(lcms % (lcm / i)) && !(lcm % i)) {
				lcm = lcm / i;
				break;
			}
	
		j = 0;
		//最小公倍数
		if(a > b){
			gcd = a;
			gcds = b;
		}else{
			gcd = b;
			gcds = a;
		}
		while(1){
			j++;
			hoge = gcd * j;
			if(!(hoge % gcds)){
				gcd = hoge;
				break;
			}
		}

		cout << lcm << " " << gcd << endl;
	}
	return 0;
}

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

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

int main(){
  while(true){
    int a,b;
    cin >> a >> b;

    if(cin.eof())
    break;

    int g=gcd(a,b);
    cout << g << " " << a/g*b << endl;
  }

  return 0;
}

C++: #include<iostream>
int g(int x,int y){return y?g(y,x%y):x;}
int main(){
int x,y;
while(std::cin>>x>>y)std::cout<<g(x,y)<<' '<<x*y/g(x,y)<<'\n';
}

C++: #include<iostream>
using namespace std;
int main(void){
    long a, b;
    while(cin >> a >> b){
        long _a = a, _b = b;
        long gcd, lcm;

        while(a%b != 0){
            gcd = a%b;
            a = b;
            b = gcd;
        }
        lcm = (_a * _b)/gcd;
        cout << gcd << ' ' << lcm << endl;
    }
}

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


 
int main(){
	int in[2],a,b,ans[2],i = 1,n,stop = 1;
	while(cin >> in[0] >> in[1]){
		a = in[0];
		b = in[1];
		if(a >= b){
			while(a >= 0){
				if(in[0] % a == 0 and in[1] % a == 0){
					ans[0] = a;
					break;
				}
				a--;
			}
		}else if(b >= a){
			while(b >= 0){
				if(in[0] % b == 0 and in[1] % b == 0){
					ans[0] = b;
					break;
				}
				b--;
			}
		}else{
			ans[0] = 1;
		}
		cout << ans[0] << endl;
		a = in[0];
		b = in[1];
		ans[1] = 1;
		n = 1;
		i = 1;
		while(i <= a or i <= b and stop == 1){
		n = 1;
		cout << " << i = " << i << endl;			
			while(i >= n){
				cout << "n = " << n << endl;
				if(a * i == b * n){
					ans[1] = a * i;
					stop = 0;
					break;
				}
				n++;
			}
		
		i++;
		}
		stop = 1;
		cout << ans[1] << endl;
		
	}
}

C++: #include <stdio.h>

int main(){
	int a,b,gcd,lcm,status,temp;
	while(1){
		status=scanf("%d%d",&a,&b);
		
		if (status==EOF) break;
		
		if (a>b){
			temp=b;
			b=a;
			a=temp;
		}
		
		gcd=a;
		
		while(gcd%b!=0){
				gcd+=a;
		}
		
		lcm=b/gcd*a;
		
		if (lcm==0){
			if (a*b==gcd)lcm=1;
		}

		printf ("%d %d\n",lcm,gcd);
	}
	return 0;
}

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

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

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

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

int main() {
    int a,b;
    while (cin>>a>>b) {
        int gcd = a;
        while (!(a % gcd == 0 && b % gcd == 0)) {
            gcd--;
        }

        int i = 1;
        while (a * i % b != 0) {
            i++;
        }
        int lcm = a * i;
        cout << gcd << " " << lcm << endl;

    }
    return 0;
}

C++: #include <stdio.h>
long long main(void){
    int a, b, c, d, tmp;
        scanf("%d %d", &a, &b);
     d = a * b;
    if(a < b) {
        tmp = a;
        a = b;
        b = tmp;
    }
     c = a % b;
    while(c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
        printf("%d %d\n", b, d / b);
            return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <cstdlib>

using namespace std;

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

int main() {
    int a, b;
    while (scanf("%d %d", &a, &b) != EOF) {
        printf("%d %d\n", gcd(a, b), lcm(a, b));
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int a,b;
void func(int x,int y){
	if(y==0){
		cout<<x<<' '<<a/x*b<<endl;
	}else{
		func(y,x%y);
	}
}
int main(){
	while(cin>>a>>b){
		if(a>b)
		func(a,b);
		else func(b,a);
	}
	return 0;
}

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 n,m;
	int gcb,lcm;
	while(cin>>n>>m){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		if(n%i==0 && m%i==0)
			gcb=i;
	}
	lcm=gcb*(n/gcb)*(m/gcb);
	cout<<gcb<<" "<<lcm<<endl;
		}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()

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(void){
  int a,b;
  while(cin >> a >> b){
    cout<< gcd(a,b) << " " << lcm(a,b) << endl;
  }
}

C++: #include<iostream>
using namespace std;
int main(void){
    long a, b;
    while(cin >> a >> b){
        long _a = a, _b = b;
        long gcd, lcm;

        while(a%b != 0){
            gcd = a%b;
            a = b;
            b = gcd;
        }
        lcm = (_a * _b)/gcd;
        cout << gcd << ' ' << lcm << endl;
    }
}

C++: #include<stdio.h>
int main(){
  long long a,b,m,l;
  while(scanf("%d %d",&a,&b)!=EOF){
    m = a%b;
    l = a*b;
    while(m){
      a = b;
      b = m;
      m = a%b;
    }
    printf("%d %d\n",b,l/b);
  }
}