Go: package main

import (
	"fmt"
)

func main() {
	var a, b int
	for {
		i, _ := fmt.Scan(&a, &b)
		if i == 0 {
			break
		}

		gcd := getGCD(a, b)
		fmt.Println(gcd, getLCM(a, b, gcd))
	}
}

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

func getLCM(a, b, gcd int) int {
	return a * b / gcd
}

C++: #include <cstdio>
#include<iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstring>
#include <string.h>
#include<vector>
#include <set>
#include <vector>
#include <iterator>
using namespace std;
typedef long long int ll;

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a % b);
}
 ll LCM(ll a, ll aa, ll b)
 {
    return a % b == 0 ? a : LCM(a + aa, aa,b);
 }

 int main()
 {
     ll a, b;
     while(~scanf("%lld %lld", &a, &b))
     {
         printf("%lld %lld\n", gcd(a, b), LCM(a, a, b));
     }
     return 0;
 }

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

long gcd(long, long);

int main()
{
	long a,b;

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

	return 0;

}

long gcd(long a, long b) //a>=b
{
	if(b==0){
		return a;
	} else {
		return gcd(b, a%b);
	}
}

C++: #include <iostream>
int gcd(int a, int b) {
	return (a ? gcd(b % a, a) : b);
}
int main() {
	int a, b, x;
	while (std::cin >> a >> b) {
		x = gcd(a, b);
		std::cout << x << " " << a / x * b << std::endl;
	}
}

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

int gcd(int a, int b)
{
    int i;
    if (b > a){
        int j = a;
        a = b;
        b = j;
    }
	for (i = a; i >= 1; i--){
		if (a % i == 0)
			if( b % i == 0)
				return i;
	}
}


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