Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [100]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == 0 {
			break
		}
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>

#define rep(x,to) for(x=0;x<to;x++)
#define rep2(x,from,to) for(x=from;x<to;x++)

using namespace std;

int gcd( int m, int n )
{
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm


int main(void){

int l1,l2;
int gc,lc;
char mz;
	while(cin >> l1 >> l2){
		gc = gcd(l1,l2);
		lc = lcm(l1,l2);
		cout << gc << " " << lc << endl;
	}	
	return 0;
}

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