Go: package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for sc.Scan() {
		var a, b int
		fmt.Sscanf(sc.Text(), "%d %d", &a, &b)
		gcd := gcd(a, b)
		fmt.Printf("%d %d\n", gcd, (a/gcd)*b )
	}
}

func gcd(a int, b int) (gcd int) {
	var i, j, k int
	if a > b {
		i = a
		j = b
	} else {
		i = b
		j = a
	}

	k = i % j

	for k > 0 {
		num := i
		i = j
		j = num % i
		k = i % j
	}

	return j
}

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

C++: #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<ll> Vl;
typedef vector<int> Vi;
typedef pair<int, int> Pi;

#define INF   (1e9 + 7)
#define MAX_AB (2000000000)

ll A, B;

ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}

void solve() {
  ll ans0 = gcd(A, B);
  ll ans1 = A * (B / ans0);


  printf("%lld %lld\n", ans0, ans1);
}

int main() {
  while(scanf("%lld %lld", &A, &B) != EOF){
    solve();
  }

  return 0;
}

C++: #include <iostream>
int g(int x,int y){return y?g(y,x%y):x;}
int main(){
int a,b;
while(~scanf("%d%d",&a,&b))printf("%d %d\n",g(a,b),a*b/g(a,b));
}

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

int main() {
	int a, b, c, d, e, f, g, l;
	while (cin >> a >> b) {
		c = a; d = b;
		e = a; f = b;
		while (1) {
			if (a >= b) {
				a %= b;
				if (a == 0) { g = b; break; }
			}
			else if (a<b) {
				b %= a;
				if (b == 0) { g = a; break; }
			}
		}
		while (1) {
			if (c>d) d += f;
			else if (c < d) c += e;
			if (c == d) { l = c; break; }
		}
		cout << g << " " << l << endl;
	}
}

C++: # -*- coding: utf-8 -*-
import sys
import fractions

def lcm(a,b):
    return a / fractions.gcd(a,b) * b

for s in sys.stdin:
    a,b = map(int,s.split())
    gcd_ab = fractions.gcd(a,b)
    lcm_ab = lcm(a,b)

    print gcd_ab,lcm_ab