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() {
		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>

#define     MAX_NUMBER         2000000000
#define     __ERROR_CODE__     (-1)

using namespace std;

int Integer_LCM(const unsigned int,const unsigned int);
int Integer_GCD(const unsigned int,const unsigned int);

int main(){
	int a,b;

	while(cin >> a >> b){
		cout << Integer_LCM(a,b) << " " << Integer_GCD(a,b) << endl;
	}

	return 0;
}

int Integer_LCM(const unsigned int a,const unsigned int b){
	int p,q,r;

	// 入力値の確認
	if((a <= 0) || (b <= 0) || (a > ((int)(MAX_NUMBER))) || (b > ((int)(MAX_NUMBER)))){
		return ((int)(__ERROR_CODE__));
	}

	// 変数の初期化
	p = a;
	q = b;
	r = a % b;

	// ユークリッドの互除法
	while (r != 0){
		p = q;
		q = r;
		r = p % q;
	}

	return q;
}

int Integer_GCD(const unsigned int a,const unsigned int b){
	// 入力値の確認
	if((a <= 0) || (b <= 0) || (a > ((int)(MAX_NUMBER))) || (b > ((int)(MAX_NUMBER)))){
		return ((int)(__ERROR_CODE__));
	}

	return ((a * b) / Integer_LCM(a,b));
}

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

u_int euclid_alg(const u_int a, const u_int b) {
	return a > b ? a % b : b % a;
}

int main(void) {
	u_int a,b;
	std::vector<u_int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}

	for(int i = 0; i < (int)num.size(); i+=2){
		u_int pro = num[i] * num[i+1];
		while(num[i] != 0 && num[i+1] != 0){
		if(num[i] > num[i+1]){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}

		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < (int)num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}

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


 int euclid(int a, int b){
  if (b < a) {
    int c = b;
    b=a;
    a=c;
  }
  int r=a%b ;
  while(r)
  {
  a=b;
  b=r;
  r=a%b;
  }
return b;
}
int main(){
  int a,b;
  while(cin >> a >> b)
    cout << euclid(a,b) << " "<<a*b/(euclid(a,b))<<endl;
}

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

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

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

C++: #include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
using namespace std;
long long m,n,gcd,lcm;
int main()
{
    while(cin>>m>>n)
    {
        if(m==1||n==1)
        {
            cout<<1<<" "<<m*n<<endl;
        }
        else
        {

        long long d=0,s=m;
       if(m>n)
       {
         s=n;
       }
       for(long long i=1;i<=s;i++)
       {
           if(m%i==0&&n%i==0)
           {
               d=max(d,i);
           }
       }
       cout<<d<<" "<<(m*n)/d<<endl;

        }
    }
}

C++: #include <fstream>
#include <iostream>
#include <string>
#include <cstring>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <ctime>
#include <assert.h>

#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define eps 1e-8
#define M_PI 3.141592653589793

typedef long long ll;
const ll mod=1000000007;
const int inf=0x7fffffff;
ll powmod(ll a,ll b) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
using namespace std;
ll gcd(ll a,ll b) {return b==0? a: gcd(b,a%b);}
int main()
{
    ll a,b;
    while(cin>>a>>b){
        cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<endl;
    }
}

C++: #include<stdio.h>
int main(){
  unsigned long long a,b,m,ca,cb;
  while(scanf("%d %d",&a,&b)!=EOF){
    m = a%b;
    ca = a;
    cb = b;
    while(m){
      a = b;
      b = m;
      m = a%b;
    }
    cb /= b;
    printf("%d %d\n",b,ca*cb);
  }
}

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

int yaku(int x, int y);
int bai(int n, int m);

int main(void){

	int n, m;
	while (cin >> n >> m){
	
		int gcd; //?????§??¬?´???°
		int lcm; //????°???¬?????°

		gcd = yaku(n, m);
		lcm = bai(n, m);

		cout << gcd << ' ' << lcm << endl;
	}
}

int yaku(int x, int y){

	if (x < y){
		int temp = x;
		x = y;
		y = temp;
	}

	while (y != 0){
		int temp = x % y;
		x = y;
		y = temp;
	}

	return x;
}

int bai(int n, int m){

	int x = n, y = m;

	while (x != y){
		if (x < y)
			x = x + n;
		else
			y = y + m;
	}

	return x;
}

C++: #include <iostream>
using namespace std;
int main() {
  int a, b, m, tmp_a, tmp_b;
  while (cin >> a >> b) {
    tmp_a = a;
    tmp_b = b;
    while (tmp_a != 0 && tmp_b != 0) {
      if (tmp_a > tmp_b) {
        tmp_a = tmp_a % tmp_b;
      } else {
        tmp_b = tmp_b % tmp_a;
      }
    }
    m = max(tmp_a, tmp_b);
    if (m == 0) {
      printf("%d %d\n", 0, 0);
    } else {
      printf("%d %d\n", m, a / m * b);
    }
  }
  return 0;
}

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

int gcd( unsigned int, unsigned int );
int main(void)
{
	unsigned int a, b, g, l;

	while( std::cin >> a >> b ){
		g = gcd( a, b );
		l = a * b / g;
		std::cout << g << std::endl;
		std::cout << l << std::endl;
	}

	return 0;
}

int gcd( unsigned int a, unsigned int b ){
	int n, i;
	unsigned int tmp[3];

	tmp[0] = std::max( a, b );
	tmp[1] = std::min( a, b );

	for( n = 0;; n++ ){
		for( i = 1;; i++ ){
			tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i;
			if( tmp[( n + 2 ) % 3 ] < tmp[( n + 1 ) % 3 ] ){
				break;
			}else if( tmp[ n % 3 ] * tmp[( n + 1 ) % 3 ] * tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[0] + tmp[1] + tmp[2] - std::max( tmp[0], std::max( tmp[1], tmp[2] ));  
			}
		}
	}

	return -1;
}

C++: import sys
def main():
    for line in sys.stdin:
        a,b = map(int, line.split())
        if a > b:
            a,b = b,a
        p = a * b #product

        while True:
            hoge = a
            a = b % a
            b = hoge
            if a == 0:
                gcd = b
                break

        lcm = p // gcd
        print(gcd, lcm)




if __name__ == "__main__":
    main()

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

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

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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)

int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  int a,n;
  while(cin>>a>>n){
  cout<<gcd(a,n)<<" "<<lcm(a,n)<<endl;
  }
}