Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

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

int main(){

  int n[2];
  int yaku,bai;
  while(cin >> n[0] >> n[1]){
    sort(n,n+2);
    for(yaku=n[0];1<yaku;yaku--)
      if(n[0]%yaku==0 && n[1]%yaku==0)
	break;

    for(bai=1;bai<=n[0];bai++)
      if((bai*n[1])%n[0]==0){
	bai *= n[1];
	break;
      }
    cout << yaku << ' ' << bai << endl;
  }
  return 0;
}

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

int main()
{
	int a,b;
	while(scanf("%d %d",&a,&b))
	{int gcd=0;
	int lcf=0;
	for(int i=2;i<=min(a,b);i++)
		if(a%i==0&&b%i==0)gcd=i;
	for(int i=b;i>1;i--)
		if(a*i%b==0)lcf=a*i;
	cout<<gcd<<" "<<lcf<<endl;
	}
}

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