Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

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

int main(){

	int a, b, tmp, gcd, lcm;
	
	while(cin >> a >> b){
	
		if(a > b){
			tmp = a;
			a = b;
			b = tmp;
		}
	
		gcd = a;
		for(int i=2;; i++){
			if(b % gcd == 0 || gcd == 1) break;
			else gcd = a / i;
		}
		
		lcm = b;
		for(int i=2;; i++){
			if(lcm % a == 0) break;
			else lcm = b * i;
		}
	
		cout << gcd << " " << lcm <<endl;
	
	}

	return 0;
}

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

int main(){
	long a,b,x,y,g,l,buf;
	while(cin >> a >>b){
		if(a>b){
			x=a;
			y=b;
		}else{
			x=b;
			y=a;
		}
		while(x%y!=0){
			buf=x;
			x=y;
			y=buf%y;
		}
		cout << y << " " << (a*b/y) << endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(void) {
	int buf,i,c;
	long int a,b,gcd = 1, lcm;
	
	while(scanf("%ld%ld",&a,&b) != EOF){
		if(b > a){buf = a;a = b;b = buf;}
		for(i = 2; a/2 > i;i++){
			if(b%(a/i) == 0) {gcd = a/i;break;}
		}
		for(i = 2; ;i++){
			if((a*i)%b == 0) {lcm = a*i;break;}
		}
		printf("%d %d\n",gcd, lcm);
	}
	
	return 0;
}

C++: #include<iostream>

int main(){
        int a,b;
        while(std::cin >> a >> b){
                int ta,tb,r,gcd,lcm;
                if(a<b){
                        r = a;
                        a = b;
                        b = r;
                }
                ta = a; tb = b;

                r = ta % tb;
                while(r != 0){
                        ta = tb;
                        tb = r;
                        r = ta % tb;
                }
                gcd = tb;
                ta = a; tb = b;
                ta = (int)(ta / gcd);
                tb = (int)(tb / gcd);
                lcm = ta * tb * gcd;
                std::cout << gcd << " " << lcm << std::endl;
        }
        return 0;
}

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

int main(){
	int a = 0;
	int b = 0;
	int max = 0;
	int min = 0;
	int d = 1;
	int a_bk = 0;
	int b_bk = 0;

	while (cin >> a >> b) {
		if (a > b) {
			max = b;
			min = a;
		}
		else {
			max = a;
			min = b;
		}

		a_bk = a;
		b_bk = b;
		d = 1;

		for (int c = 2; c <= max ; c++) {
			while(a%c == 0 && b%c == 0) {
				a /= c;
				b /= c;
				d *= c;
				
			}
		}
		cout << d << "\n";

		a = a_bk;
		b = b_bk;

		for (min; min <= 2000000000; min++) {
			if (min%a == 0 && min%b == 0) {
				cout << min << "\n";
				break;
			}
		}
	}


	return 0;
}

C++: #include<cstdio>

using namespace std;

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

int main(void){
	int a,b;
	int g;

	for(;scanf("%d%d",&a,&b)==2;){
		g=gcd(a,b);
		printf("%d %d\n",g,a/g*b);
	}

	return 0;
}

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

long GCD(long, long);
long LCM(long, long);

long gcd, lcm;

int main(){
	long a, b;
	while(cin >> a >> b){
		if(a < b)
			swap(a, b); // a > b
		gcd = GCD(a, b);
		lcm = LCM(a, b);
		cout << gcd << " " << lcm;
	}
	return 0;
}

long GCD(long a, long b){
	if(b == 0)
		return a;
	else
		return GCD(b, a%b);
}

long LCM(long a, long b){
	return a*b/gcd;
}

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

int GCD(int a,int b)
{
    while (b != 0) {
        int rest = a % b;
        a = b;
        b = rest;
    }
    return a;
}

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

int main()
{
    for (int a, b; cin >> a >> b;)
        cout << GCD(a, b) << " " << LCM(a, b) << endl;

    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;

//?????§??¬?´???°(????????????????????????????????????)
template<class T>T GCD(T a, T b);

//????°???¬?????°(ab == (GCD)(LCM) ??????)
template<class T>T LCM(T a, T b);


int main()
{
	long long a, b;
	cin >> a >> b;
	
	do{
		cout << GCD(a, b) << " " << LCM(a, b) << endl;
	}while( (cin >> a >> b) );
	
	return 0;
}


template<class T>T GCD(T a, T b)
{
	T ans;
	do
	{
		if( a == b )
		{
			ans = a;
			break;
		}
		
		if( a < b )swap(a, b);
		a -= b;
		
	}while( 1 );
	
	return ans;
}

template<class T>T LCM(T a, T b)
{
	return a * b / GCD(a, b);
}

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


int main(){

	int a, b;

	while(cin >> a >> b){

		long m = ( a>=b ? a : b );
		long n = ( a>=b ? b : a );

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

		cout << m << " " << a / m * b  << endl;

	}

	return 0;
}

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


const int GCM(const int a,const int b){
	int x(a),y(b);
	while(x%=y){
		std::swap(x,y);
	}
	return y;
}

const int LCM(const int a,const int b){
	int x(a),y(b);
	while(x%=y){
		std::swap(x,y);
	}
	long long tmp(a);
	tmp*=b;
	tmp/=y;
	return tmp;
}


int main(int,char**){
	int a,b;
	while(std::cin >>a){
		std::cin >> b;
		std::cout << GCM(a,b) << ' ' << LCM(a,b)<<std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int gcd (int a, int b) {
	for (;;) {
		if (!(a %= b)) return b;
		if (!(b %= a)) return a;
	}
}
int main () {
	int a, b, n, m;
	while (cin >> a >> b) {
		m = (n = gcd (a, b)) ? a/n*b : 0;
		cout << n << " " << m << endl;
	}
}

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

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    //gcd = u(a, b);
  / lcm = l(a, b);
//printf("%d %d\n",gcd, lcm);
    //std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0){return i;}
      else{i++;}
    }else{
      i++;
    }
  }
}

C++: #include<cstdio>
int g(int x,int y){
	if(y==0)return x;
	return g(y,x%y);
}

int main(){
	int a,b;
	while(~scanf("%d%d",&a,&b))printf("%d %d\n",g(a,b),a/g(a,b)*b);
}

C++: #include<iostream>
using namespace std;
int gcd(int a,int b) {
  if(a<b) {
    int tmp=a;
    a=b;
    b=tmp;
  }
  if(a%b==0) return b;
  return gcd(b,a%b);
}

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

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

long gongyueshu(long a,long b);
int  main()
{
	long  a,b,c,d;
	 while(scanf("%d %d",&a,&b)!=EOF)
	 

	{
	

	c=gongyueshu(a,b);
	d=a/c*b;
	
	cout<<c<<" "<<d<<endl;

}
	return 0;
	
	
} 
long gongyueshu(long a,long b)   
{
	if(a%b==0)
  return b;
 return gongyueshu(b,a%b);
}

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

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

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

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

int main(){
	int a,b;
	int i=1;
	int j=1;
	while(cin>>a>>b){
		while(1){
		if(a%i!=0){
			i++;
			continue;
		}
		if(b%j!=0){
			j++;
			continue;
		}
		if(a/i<b/j){
			j++;
			continue;
		}
		if(a/i>b/j){
			i++;
			continue;
		}
		if(a/i==b/j){
		cout<<a/i<<" ";
		break;
		}
	}
	
	i=1;
	j=1;
	while(1){
	if(a*i<b*j){
		i++;
		continue;
	}
	if(a*i>b*j){
		j++;
		continue;
	}
	if(a*i==b*j){
		cout<<a*i<<endl;
		break;
	}
	}
	}
return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	int a, b, c, r;
	int gcd, lcm;
	int x, y;

	while (cin >> a >> b){
		x = a;
		y = b;
		if (b > a){
			c = a;
			a = b;
			b = c;
		}

		while(1){
			r = a % b;
			if (r == 0){
				break;
			}
			a = b;
			b = r;
		}
		gcd = b;
		x /= gcd;
		y /= gcd;

		cout << gcd << " " << x * y * gcd << endl;
	}

	return 0;
}