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>
using namespace std;

int main() {
unsigned long long a,b,e,f,l;
	while(cin>>a>>b){
		e=a;
		f=b;
		while(1){
		if(e>f){
			e=e-f;
		}
	    if(f>e){
	    	f=f-e;
	    }
	    if(f==e){
	    	l=e;
	    	cout<<l<<" "<<(a*b)/l<<endl;
	    	;break;
	    }
		}
	}
	return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int gcd(long long a,long long b)
{
	if(!b)
		return a;
	return gcd(b,a%b);
}
int main()
{
	long long n,m;
	while(scanf("%lld%lld",&n,&m))
	{
		int tp=gcd(n,m);
		printf("%lld %lld\n",tp,n/tp*m);
	}
	return 0;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(1){
		int tmp=a;
		a=b;
		b=tmp%b;
		if(a%b==0)break;
	}
	if(b!=0)cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: #include<stdio.h>

int main(void)
{
	int x[1000],x2[1000],y[1000],y2[1000],z[1000],w[1000],t[1000],i=0,j=0;

	while(i!=-1)
	{
		scanf("%d %d",&x[i],&y[i]);		   
		x2[i] = x[i];
		y2[i] = y[i];
		if(x[i]<=0 || x[i]>2000000000 || y[i]<=0 || y[i]>2000000000)break;
		i=i+1;
	}
	for(j=0;j<i;j++)
	{
	   while(x[j] % y[j] !=0)
	   {
     	  z[j] = x[j] % y[j];
 		  x[j] = y[j];
 		  y[j] = z[j];
	   }
	   w[j] = x2[j] * y2[j] / y[j];
	   printf("%d %d\n",y[j],w[j]);
	}
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <map>
 
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<stdio.h>
int main(void)
{
	int a,b,x,y,s;
	int i,temp;

	while(scanf("%d %d",&a,&b)!=EOF){
		x=a;
		y=b;
		if(a<b){
			
			temp=a;
			a=b;
			b=temp;
		}
		while(b!=0){
			a=a%b;
			temp=a;
			a=b;
			b=temp;
		}
		x=x/a;
		y=y/a;
		s=a*x*y;
		printf("%d %d\n",a,s);
	}
	return 0;
}

C++: 
#include <stdio.h>

void sort(int *a, int *b) {
  if (*a < *b) {
    *a += *b;
    *b = *a - *b;
    *a -= *b;
    return;
  } else {
    return;
  }
}

int GCD(int a, int b) {
  int j, i = 1;
  
  if (a == 1 || b == 1) {
    return 1;
  }
  
  for (j = 2; j <= a; j++) {
    if (a % j == 0 && b % j == 0) {
      
      a /= j;
      b /= j;
      i *= j;
      i *= GCD(a, b);

      break;
      
    }
  }
  
  return i;
}

long LCM(int a, int b, int c) {
  long i;
  
  if (a % b == 0) return a; 
  
  i = a * b / c;
  
  return i;
}

int main() {
  
  int a, b;
  int n;
  long m;
  while (1) {
    if (scanf("%d %d", &a, &b) == EOF) break;
    
    
    sort(&a, &b);
    n = GCD(a, b);
    m = LCM(a, b, n);
    printf("%d %ld\n", n, m);
  }
  return 0;
}

C++: #include<stdio.h>
#include<string.h>

int GCD(int x,int y)
{
  if(y==0)
    return x;
  return GCD(y,x%y);
}

int LCM(int x,int y)
{
  int i;
  for(i=1;i<=y;i++)
    {
      if((x%i)%y == 0)
	return x*i;
    }
  return x*y;
}



int main(void)
{
  int a,b,k;
  while(scanf("%d %d",&a,&b) != EOF)
    {
      if(a<b){
	 k = b;
	b = a;
	a = k;
      }
      printf("%d %d\n",GCD(a,b),LCM(a,b));
    }
}

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

using namespace std;

int GCD (int a, int b) {
    while (1) {
        if (a < b) swap(a, b);
        if (b == 0) break;
        a = a % b;
    }
    return a;
}

int LCM (int a, int b) {
    return a / GCD(a, b) * b;
}

int main (void) {
    int a, b;
    while (1) {
        cin >> a;
        cin >> b;
        if (cin.eof()) break;
        cout << GCD(a, b) << ' ' << LCM(a, b) << endl;
    }
    return 0;
}

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

int gcd(int a, int b){
    assert(a>=0 && b >=0);
    if(a < b){
        return gcd(b,a);
    }
    if(b == 0){
        return a;
    } else {
        return gcd(b,a%b);
    }
}

int lcm(int a, int b){
    assert(a>=0 && b >=0);
    if(b == 0){
        return a;
    } else {
        return gcd(b,a%b);
    }
}

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

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

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

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

long gongyueshu(long a,long b);
int  main()
{
	long  a,b,c,d;
	while((cin>>a>>b)&&a!=EOF&&b!=EOF)
	{
	

	c=gongyueshu(a,b);
	d=a/c*b;
	
	cout<<c<<" "<<d<<endl;
}
	
	
} 
long gongyueshu(long a,long b)    //----------找最大公?数   最小公倍数=?数的乘?/最大公?数
{
	if(a%b==0)
  return b;
 return gongyueshu(b,a%b);
}

C++: #include <cstdio>

int main()
{
        unsigned long a, b;

        while (scanf("%lu %lu", &a, &b) != EOF) {
                unsigned long max = (a > b) ? a : b,
                                          min = (a < b) ? a : b;
                while (min) {
                        int r = max % min;
                        max = min;
                        min = r;
                }
                unsigned long lcm = a * b / max;
                printf("%lu %lu\n", max, lcm);
        }

        return 0;
}

C++: #include<iostream>
#include<list>
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) > (b) ? (b) : (a))
using namespace std;


int main(){
	long a,b,r,x,y;
	list<long> aby;
	
	while(!(cin>>a>>b).eof()){
		x=a,y=b;
		while(1){
			r=MAX(x,y)%MIN(x,y);
			if(r==0) break;
			x=MIN(x,y);
			y=r; 
		}
		aby.push_back(a);
		aby.push_back(b);
		aby.push_back(MIN(x,y));
		
	}
	list<long>::iterator it = aby.begin();
	while(it != aby.end()){
		a = *it, it++;
		b = *it, it++;
		y = *it;
		cout << y << " "<<(a*b)/y <<endl;
		it++;
	}
	
	return 0;
}

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

int main(){
   int a,b;
   int A,B;
   int GCD,LCM;
   int z;
   
   while(cin>>A>>B){
      if(A<B){
         z = A;
         A = B;
         B = z;
      }
      a = A;
      b = B;
   
      while(1){
         if(a%b == 0){
            GCD = b;
            break;
         }
         z = a%b;
         a = b;
         b = z;
      }
      LCM = A*B/GCD;
      
      printf("%d %d\n",GCD,LCM);
   }
   return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int a,int b){
    while(a>0||b>0){
        if(a>b)
            a%=b;
        else
            b%=a;
    }
    if(a==0)
        return b;
    else if(b==0)
        return a;
}
int main(){
    int a,b;
    while(cin>>a>>b){
        int c=gcd(a,b);
        int lcm=(a*b)/c;
        cout<<c<<" "<<lcm<<endl;
    }
    return 0;
}

C++: #include <cstdio>

int main()
{
    int a, b;
    int m, n, temp;

    while (scanf("%d %d", &a, &b) != EOF) {
        m = a;
        n = b;
        if (m < n) {
            temp = m;
            n = m;
            m = temp;
        }

        while (n > 0) {
            temp = n;
            n = m % n;
            m = temp;
        }

        printf("%d %d\n", m, a / m * b);
    }

    return 0;
}

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

typedef long long lli;

lli gcd(lli a, lli b) { return b == 0 ? a : gcd(b, a%b);}

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