Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main(){
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan(){
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, y)
	}

}

func nextInts()(a, b int){
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

func gcd(x, y int) int{
	if x<y{
		gcd(y, x)
	}
	for 0<y{
		r := x%y
		x, y = y, r
	}
	return x
}

func lcm(x, y int)int{
	return (x*y)/gcd(x, y)
}

C++: #include<iostream>
using namespace std;
int a,b;
int gcd(int x,int y){
    a=x;
    b=y;
    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(){
   
    while(cin>>x>>y){
        int c=gcd(x,y);
        int lcm=(x*y)/c;
        cout<<c<<" "<<lcm<<endl;
    }
    return 0;
}

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

int gcd(int u, int v)
{
  int r, z;

  if(v > u)
  {
    z = u;
    u = v;
    v = z;
  }

  while((r = u%v) != 0)
  {
    u = v;
    v = r;
  }    
  return v;  
}


int main(void)
{
  int a, b;

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

  return 0;
}

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

int main() {
	int a, b,i;
		while (cin >> a >> b) {
			for (i = a; i > 0; i--) {
				if (b%i == 0 && a%i == 0) {
					cout << i << " ";
					break;
				}
				//if (i == 0)
					//cout << 1 << " ";
			}
			if (a > b)
				i = a;
			else
				i = b;
			if (a > b) {
				for (i = a; i%b; i += a);
				cout << i << endl;
			}
			else {
				for (i = b; i%a; i += b);
				cout << i << endl;
			}
		}
	return 0;
}

C++: #include <iostream>

using namespace std;

int gcd(int a, int b){
	if(b>0){
		return gcd(b, a%b);
	}
	else{
		return 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 <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;
			}
		}
		lcm /= gcd;
		cout << gcd << " " << lcm << endl;
	}
}

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

int main(){
	int a, b, dmy, t, gcd, lcm;
	while( scanf("%d%d",&a,&b)!=EOF ){
		t=a*b;
		while(a!=b){
			while(a>b) a-=b;
			while(a<b) b-=a;
		}
		gcd=a;

		lcm=t/gcd;
		printf("%d %d\n",gcd, lcm);
	}
	exit(0);
}

C++: #include<iostream>
#include<utility>
using namespace std;
int main()
{
  long long int n=0,m=0;
  long long int i=0,j=0,l=0;

  while(scanf("%d %d",&n,&m) != EOF)
    {
      i = n;
      j = m;

      //koyaku
      if((n >= m) != true)swap(n,m);
      while(1)
	{
	  int amari = n % m;
	  n = m;
	  m = amari;
	  if(amari == 0) break;
	}
      
      //kobai
      l = i*j/n;
      
      cout << n << " " << l << endl;
    }
}

C++: #include <bits/stdc++.h>
long long gcd;

int euklides(long long a, long long b) {
    while (a % b!= 0) {
        int tmp = b;
        b = a % b;
        a = tmp;
    }
    return b;
}

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

int main()
{
    long long a, b;
    while (std::cin >> a >> b) {
        if (b > a) std::swap(a, b);
        int lc = lcm(a, b);
        std::cout << gcd <<  " " << lc << std::endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int tempmax(int &m,int &n)
{
	int temp;
	temp=m;
	m=n;
	n=temp;
	return 0;
}
int gcd(int m,int n)
{
	int r;
	if(n>m)
	tempmax(m,n);
	do
	{
		r=m%n;
		m=n;
		n=r;
	}while(r!=0);
	return m;
	
}
int main()
{
	int n,m,temp,i,max;
	long long min;
	while(cin>>m>>n)
	{
		max=gcd(m,n);
		min=m/max*n;
		cout<<max<<" "<<min<<endl;
		
		
	}
	return 0;
 }

C++: #include <iostream>
#include <fstream>
#include <cstdio>
#include <math.h>
#include <limits>
using namespace std;

int main() {
	int x;
	int y;
	int g;
	while (scanf("%d %d", &x, &y)==2) {
		g=x*y;
		while (x*y!=0) {
			if (x>y) {
				x=x%y;
			}
			else {
				y=y%x;
			}
		}
		if (x==0) {
			x=y;
		}
		cout << g/x << " " << x << "\n";
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	
	int a, b, c = 0;
	while (cin >> a, cin >> b)
	{
		for (int i = 1; i <= a, i <= b; i++)
		{
			if (a % i == 0 && b % i == 0)
			{
				c = i;
			}
		}
		cout << c << " " << a*b / c << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	long long a, b, c,d,e,A,B,C;
	c = 9;
	d = 9;
	e = 9;
	C = 9;
	while (cin >> a >> b) {
		A = a;
		B = b;
		while (1) {
			if (c == 0) { break; }
			c = a%b;
			a = b;
			b = c;
		}
		d = A / a;
		e = B / a;
		C = a*d*e;
		cout << a << ' ' << C << endl;
	}
	return 0;
}

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

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

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

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

using namespace std;

int gcd( int a, int b ){
    int t;
    int x = min(a, b);
    int y = max(a, b);
    while( y%x != 0 ){
        t = y - x;
        y = max(x, t);
        x = min(x, t);
    }
    return x;
}

int lcm( int a, int b ){
    int x = a;
    int y = b;
    while( x != y ){
        if(x<y)
            x += a;
        else
            y += b;
    }
    return x;
}

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 GCD,LCM,a,b;

int GreatCommonDivisor(int x,int y)
{
    while(x!=y)
    {
        if(x<y)
        {
            y = y-x;
        }
        else if(x>y)
        {
            x = x-y;
        }

    }
            return x;
}
int LeastCommonMultiple(int x,int y)
{
   return (x*y)/GreatCommonDivisor(x,y);
}

int main()
{
    while(cin >> a >> b)
    {
    GCD = GreatCommonDivisor(a,b);
    LCM = LeastCommonMultiple(a,b);
    cout << GCD << " " << LCM;
    }

}

C++: 
#include <iostream>

using namespace std;

typedef unsigned long long ull;

int main()
{
	ull a, b, t;
	while(!cin.eof())
	{
		cin >> a >> b;
		ull M = a > b ? a : b;
		ull m = a < b ? a : b;
		while(m != 0)
		{
			t = M % m;
			M = m;
			m = t;
		}

		printf("%llu %llu\n", M, a / M * b);
	}
}

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

using namespace std;

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

C++: #include <iostream>

using namespace std;

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

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

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

int main()
{
	long a,b;
	while(cin>>a>>b)
	{
		for(long i=min(a,b);i>0;i--)
		{
			if(a%i ==0)
				if(b%i==0)
				{
					cout<<i<<" ";
					break;
				}
		}
		for(long i=max(a,b);i<=2000000000;i+=max(a,b))
		{
			if(i%a ==0)
				if(i%b==0)
				{
					cout<<i<<endl;
					break;
				}
		}
	}
}