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

int gcd(int a, int b) {
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }

}

int main(void){
   int a, b, tmp;
   if (a < b){
       tmp = b;
	b = a;
	a = tmp;

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

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

int gcd(int a, int b);

int main()
{
	int a, b;

	while (cin >> a >> b, cin.eof() != true){
		cout << gcd(a, b) << " " << a / gcd(a, b) * b << endl;
	}

	return (0);
}

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

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

long long int gcd(long long int m,long long int n)
{
	if (n == 0)
		return m;
	return gcd(n,m % n);
}

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

C++: #include <iostream>
#include <stack>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
using namespace std;

int main() {
	int a, b;
	int x, y;
	int c;
	c = 0;

	while (cin >> a) {
		cin >> b;
		long long int m = a;
		long long int n = b;
		int r1, r2;
		int gcd, lcm;
		
		if (a < b) {
			c = a;
			a = b;
			b = c;
		}
		r1 = a % b;
		r2 = r1;

		while (r2 != 0) {
			r1 = r2;
			r2 = b % r1;
			b = r1;
		}
		gcd = b;
		lcm = (m * n) / gcd;

		cout << gcd << " " << lcm << endl;

	}

	return 0;
}

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

int main()
{
	int a,b,c,num1,num2,GCD,LCM;

	while(cin >> a >> b){

	//????????????
	if(b < a){
		num1 = a;
		a = b;
		b = num1;
	}
	num1 = a; num2 = b;
	//????????????????????????????????????????????§??¬?´???°????±???????
	while((b%a)!=0){
		c = b%a;
		b = a;
		a = c;
	}
	
	GCD = a;
	
	//????°???¬?????°????±???????
	
	LCM = (num1 / GCD) * num2;
	
	//???????????¨?????????
	cout << GCD << " " << LCM << endl;
	
	}
	
	return 0;
}

C++: #include<stdio.h>

#define MAX(x,y) ((x>y)?x:y)
#define MIN(x,y) ((x<y)?x:y)

int prime[30000];	//soinsuu_分解用に素数を求めておく.
int count;
int soinsuu_A[30000],soinsuu_B[30000];	//soinsuu_を入れる。

int GetPrime(int num);	//num以下の素数をprime[i]に保存
void DevPrime(int *p,int num);	//numをsoinsuu_分解。soinsuu_prime[i]の数を*(p+i)に保存。
int GetLCM(int *pa,int *pb);
int GetGCD(int *pa,int *pb);

int pwd(int tei,int sisuu){
	int ans = 1;
	for(int i = 0;i < sisuu;i++)
		ans *= tei;
	return ans;
}

int main(){
	count = GetPrime(50000); 

	int a,b;
	int LCM[200],GCD[200],cor = 0;
	while(~scanf("%d%d",&a,&b)){
		DevPrime(soinsuu_A,a);
		DevPrime(soinsuu_B,b);
		LCM[cor] = GetLCM(soinsuu_A,soinsuu_B);
		GCD[cor] = GetGCD(soinsuu_A,soinsuu_B);
		cor++;
	}
	for(int i = 0;i < cor;i++)
		printf("%d %d\n",GCD[i],LCM[i]);
	return 0;
}

int GetPrime(int num){
	int count = 0,i,j;
	for(i = 2;i <= num;i++){
		for(j = 0;j < count;j++){
			if(i%prime[j] == 0)                                                                                                                                                                                                                                               
				break;
		}
		if(j < count)
			continue;
		prime[count] = i;
		count++;
	}
	return count;
}
void DevPrime(int *p,int num){
	int i;
	for(i = 0;i < count;i++){
		//保存したい配列を初期化
		p[i] = 0;
		//割りきれなくなるまでその素数で割る。
		while(num%prime[i]==0){
			num /= prime[i];
			p[i]++;
		}
	}
}
int GetLCM(int *pa,int *pb){
	int ans = 1;
	for(int i = 0;i < count;i++){
		ans *= pwd(prime[i],MAX(pa[i],pb[i]));
	}
	return ans;
}
int GetGCD(int *pa,int *pb){
	int ans = 1;
	for(int i = 0;i < count;i++){
		ans *= pwd(prime[i],MIN(pa[i],pb[i]));
	}
	return ans;
}

C++: #include <iostream>
using namespace std;
int GCDr(int x,int y,int n,int d) {
	if (x % n == 0 && y % n == 0) {
		return n;
	}
	else {
		return d;
	}
}
int main() {
	int a, b;
	while (cin >> a >> b){
		int i, GCD, LCM;
		GCD = 0;
		if (a == b) {
			GCD = a;
			LCM = a;
		}
		else {
			if (a > b) {
				swap(a, b);
			}
			for (i = 1; i <= a || i <= b / 2; i++) {
				GCD = GCDr(a, b, i, GCD);
			}
			GCDr(a, b, i, GCD);
			LCM = a * b / GCD;
		}
		cout << GCD << " " << LCM << endl;
	}
}

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

int main(){
  long a, b;
  long l, m, n;
  while (1){
    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 <stdio.h>
using namespace std;

int gcd(unsigned long long int num1,unsigned long long int num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(unsigned long long int num1,unsigned long long int num2) {
	return num1 / gcd(num1, num2) * num2;
}

int main() {
	unsigned long long int a, b;
	while (~scanf("%d %d",&a,&b)) {
		if (b > a) {
			unsigned long long int tmp = b;
			b = a;
			a = tmp;
		}
		printf("%d %d\n", gcd(a, b),(unsigned long long int)lcm(a,b));
	}
}

C++: #include<iostream>
using namespace std;
int main(){
bool aaa;
int as,c;
float asd;
int a,b,gcd,lcm;
while(cin>>a>>b){
c=1;
gcd=1;
aaa=true;
while(aaa){
c++;
as=a/c;
asd=a/c;
if(as==asd){
as=b/c;
asd=b/c;
if(as==asd){
gcd*=c;
a/=c;
b/=c;
}
}
if(a==1||b==1){aaa=false;}
}
lcm=a/gcd*b;
cout<<gcd<<" "<<lcm<<endl;
}
}

C++: #include <stdio.h>

int main(void){
    
    int a, b, r, s;
    int temp = 0;
    
    scanf("%d %d", &a, &b);
    s = a * b;
    if(a < b){
        temp = a;
        a = b;
        b = temp;
    }
    
    r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    
    printf("%d %d\n", b, s/b);
    
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b,s,m,ta,tb,tmp;
	while(cin>>a>>b){
	ta=a,tb=b;
	s=0,m=0;
	if(a<b)swap(a,b);
	
	else 
	while(true){
		if(a==0||b==0)cout<<"a#";
		tmp=a;
		a=b;
		b=tmp%a;
		if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
}

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

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
for(i=0;i<=50;++i){
  cin>>a>>b;
x=a;y=b;
while(x!=y){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
}
L=(a*b)/x;
cout<<y<<" "<<L<<endl;
}
  return 0;
}

C++: #include <iostream>
#include <boost/math/common_factor_rt.hpp>
using namespace std;

int main() {
	int a, b;
	while (cin >> a >> b) {
		int Ngcd = boost::math::gcd(a, b);
		int Nlcm = boost::math::lcm(a, b);
		cout << Ngcd << " " << Nlcm << endl;
	}
	return 0;
}