Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"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() {
		x, y := nextInts()
		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
		}
		fmt.Fprintf(out, "%d %d\n", y, lcm/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
}

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

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    long long i,a,b,c;
    while(cin>>a>>b){
        if(a<b){
            i=b-a;
        }
        else{
            i=a-b;
        }
    for( long long j=i;j>0;i--){
        if(a%i==0 && b%i==0){
            c=i;
            break;
        }
    }
    cout<<c<<" "<<a*b/c<<endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

long gcd(long a, long b) {
  return a % b ? b : gcd(b, a % b);
}

void solve(long a, long b) {
  int c = gcd(a, b);
  cout << c << " " << a / c * b << endl;
}

int main() {
  long a, b;
  while (cin >> a >> b) solve(a, b);
}