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

    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){
    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 <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <vector>
using namespace std;

int getGcd(long int a, long int b) {
  if (a == 0) {
    return b;
  } else {
    return getGcd(b % a, b);
  }
}

int getLcm(long int a, long int b) { return a / b; }

int main(int argc, char const *argv[]) {
  long int ans_gcd, ans_lcm, a, b, tmp;
  while (!(cin >> a >> b).eof()) {
    if (a > b) {
      tmp = a;
      a = b;
      b = tmp;
    }
    ans_gcd = getGcd(a, b);
    ans_lcm = getLcm(a * b, ans_gcd);
    std::cout << ans_gcd << " " << ans_lcm << '\n';
  }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
typedef long long ll;
using namespace std;
 
int gcd(int a, int b)
{
  if(b == 0)
    {
      return a;
    }
  else
    {
      return gcd(b, a % b);
    }
}
 
int main()
{
  int a,b;
  while(~scanf("%d %d",&a,&b)){
    printf("%d %d\n",gcd(a,b),a/gcd(a,b)*b);
  }
}

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

int main(){
int a;
int b;
int c;
int d;
int e;
while(cin>>d>>e){
a=d;
b=e;
while(1){
c=a&b;
a=b;
b=c;
if(b=0){break;}
}
cout << a <<" ";
cout << d*e/a <<endl;}}

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

int getGCD(int a, int b)
{
  /* a??¨b????????§??¬?´???°???????????? */
  if (a < b) {
    std::swap(a, b);
  }
  
  int ret = 0;
  for (int i = 1; i <= a; i++) {
    if (a % i == 0 && b % i == 0) {
      ret = i;
    }
  }
  
  return ret;
}

int getLCM(int a, int b)
{
  /* a??¨b???????°???¬?????°???????????? */
  if (a < b) {
    std::swap(a, b);
  }
  
  int ret = 0;
  for (int i = a; ; i++) {
    if (i % a == 0 && i % b == 0) {
      ret = i;
      break;
    }
  }
  
  return ret;
}

int main(void)
{
  int a, b;
  while (std::cin >> a >> b) {
    std::cout << getGCD(a, b) << " " << getLCM(a, b) << std::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; 
}

if(a < b) {
  return gcd(b, a);
}

    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 <cstdio>
int gcd(int a,int b) {
	return b?gcd(b,a%b):a;
}
int lcm(int a,int b,int gcd) {
	return a/gcd*b;
}
int main() {
	int a,b,g;
	while(scanf("%d %d",&a,&b)!=EOF) {
		g=gcd(a,b);
		printf("%d %d\n",g,lcm(a,b,g));
	}
}

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

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

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

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

int get_gcd(int a, int b) {
  int r;
  while (r = a % b) {
    a = b;
    b = r;
  }
  return b;
}

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

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>

//ios::sync_with_stdio(false);

using namespace std;

const int INF = (1<<30) - 1;

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

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

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

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

long gcd(long x, long y) {
    long a = y % x;
    if (a == 0) {
        return x;
    } else {
        return gcd(a, x);
    }
}

int main() {

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

    return 0;
}

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

int main(){
  long a, b;
  long l, m, n;
  while (scanf("%ld %ld", &a, &b) != EOF){
    cin >> a >> b;
    m = a;
    n = b;

    while (1){
      if (m <= n){
        int t = m;
        m = n;
        n = t;
      }

      if (n == 0){
        cout << m << " " << a * b / m << "\n";
        break;
      }

      l = m % n;
      m = n;
      n = l;

    }

    if (a <= 0 || b <= 0){
      break;
    }
  }

  return 0;
}

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

long long gcd(long long N, long long M){
    return M?gcd(M,N%M):N;
}

long long lcm(long long N,long long M){
    return N*M / gcd(N,M);
}

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

C++:     #include<iostream>
    #include<cstdio>
    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(cin>>a>>b) {
    		cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
    	}
    	return 0;
    }

C++: #include<iostream>
using namespace std;
int main(){
long a,b,c,d,e;
for(;;){
cin>>a>>b;
if(cin.eof())break;
c=a;d=b;
if(b>a){e=a;a=b;b=e;}
while(b!=0){
a%=b;e=a;a=b;b=e;
}
cout<<a<<" "<<(c/a)*d<<endl;
}
return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    long long a,b,i,f,j;
    while(cin>>a>>b){
    for(i=15000000;i>0;i--){
        if(a>=2000000000||b>=2000000000||a<1||b<1){
            break;
        }
        if(a%i==0&&b%i==0){
                break;
        }
    }
        f=a*b/i;
        if(a==b){
            f=(a*b)/(a*b);
        }
        cout<<i<<" "<<f<<endl;
    }
    return 0;
}

C++: #include<stdio.h>

int main(void)
{
	int a[2],b[2],x,m,n,t;
	scanf("%d %d",&a[0],&b[0]);
	scanf("%d %d",&a[1],&b[1]);

	for(x=0;x<2;x++)
	{
		if(a[x]>b[x])
		{
			m=a[x];
			n=b[x];
		}
		else
		{
			m=b[x];
			n=a[x];
		}

		while(n!=0)
		{
			t=n;
			n=m%n;
			m=t;
		}
		
		t=a[x]*b[x]/m;
		printf("%d %d\n",m,t);
	}
}

C++: #include<cstdio>

using namespace std;

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

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