Go: package main

import "fmt"

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

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d", G, L)
	}
}

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

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

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

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

C++:  #include <stdio.h>

 int n,m,ans,amari,ahokusa;

 int main()
 {
     scanf("%d%d",&n,&m);
     ans  = n*m;
     if(n < m)
     {
         ahokusa = n;
         n = m;
         m = ahokusa;
     }
     amari = n % m;
     while(amari != 0)
     {
        n = m;
        m = amari;
        amari = n % m;
     }
     ans = ans / m;

     printf("%d %d\n",m,ans);
     return 0;

 }

C++: /*
 * fudq.cpp
 *
 *  Created on: 2015-10-24
 *      Author: bjfudq
 */
#include <functional>
#include <algorithm>
#include <iostream>
//#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;
//#pragma comment(linker,"/STACK:102400000,102400000")


#define MEM(a) (memset((a),0,sizeof(a)))
#define LEN(a) (int)strlen((a))
#define fr(a) for(int i=0;i<(a);i++)
#define sf(a) scanf("%d",&(a))
#define sf64(a) scanf("%I64d",&(a))
#define sff(a) scanf("%lf",&(a))
#define sfs(a) scanf("%s",(a))
#define sf2(a,b) scanf("%d%d",&(a),&(b))
#define sf3(a,b,c) scanf("%d%d%d",&(a),&(b),&(c))
#define sf2s(a,b) scanf("%s%s",(a),(b))
#define sf2f(a,b) scanf("%lf%lf",&(a),&(b))
#define sf3f(a,b,c) scanf("%lf%lf%lf",&(a),&(b),&(c))
#define sf264(a,b) scanf("%I64d%I64d",&(a),&(b))
#define sf364(a,b,c) scanf("%I64d%I64d%I64d",&(a),&(b),&(c))
#define pf(a) printf("%d\n",(a))
#define pfc(a) printf("%c",(a))
#define pf64(a) printf("%I64d\n",(a))
#define pff(a) printf("%lf\n",(a))
#define pfs(a) printf("%s\n",(a))
#define pf2(a,b) printf("%d %d\n",(a),(b))
#define pf2s(a,b) printf("%s%s\n",(a),(b));
#define pf2f(a,b) printf("%lf %lf\n",(a),(b))
#define pf264(a,b) printf("%I64d %I64d\n",(a),(b))
#define pfn printf("\n")
#define pfk printf(" ")
#define LL long long

const int N=1000010;
const int M=1000010;
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const int dir4[4][2]={{-1,0},{1,0},{0,-1},{0,1}};
const int dir8[8][2]={{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1}};
const double eps=1e-12;
const double PI=acos(-1.0);

inline int sign(double x){return (x>eps)-(x<-eps);}
template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T> inline T Min(T a,T b){return a<b?a:b;}
template<class T> inline T Max(T a,T b){return a>b?a:b;}
/*************************/


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

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

int main(){
     long a,b,x,y,t,n;
    long  gcd,r;
    long l;
    while (scanf("%lld %lld",&x,&y)!=EOF){
    if(x>y){
        a = x;
        b = y;
    }
    else{
        a = y;
        b = x;
    }

      if(a==0) gcd = b;
      else if(b==0) gcd = b;


        while(b!=0){
          t = b;
          r = a %  b;
          b = r;
          a = b;







        }
        gcd = a;



    l = (x * y)/gcd;
    printf("%lld %lld",gcd,l);
    }

    return 0;


}

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

using namespace std;

int gcd(int,int);

int main()
{
	int a,b,GCD,LCM;

	while(scanf("%d %d",&a,&b) != EOF)
	{
		GCD = gcd(a,b);

		LCM = (a*b) / GCD;

		printf("%d %d\n",GCD,LCM);
	}

	return 0;
}

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

C++: #include <iostream>

using namespace std;
unsigned gcd(unsigned a,unsigned b);
unsigned lcm(unsigned a,unsigned b);
int main(){
  unsigned a,b;

  while(cin>>a>>b){
    cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
  }
  return 0;
} 

unsigned gcd(unsigned a,unsigned b){

  while(a%b){
    a^=b;
    b^=a;
    a^=b;
    b=b%a;
  }
  return b;
}
unsigned lcm(unsigned a,unsigned b){
  return a/gcd(a,b)*b;
}

C++: #include <iostream>

int get_GCD(u_int a, u_int b)
{
    while(a != 0 && b != 0){
        if(a >= b)
            a %= b;
        else
            b %= a;
    }
    return a != 0 ? a : b ;
}

int get_LCM(const u_int a, const u_int b, const u_int GCD)
{
    int LCM = a / GCD;
    return b * LCM;
}

int main()
{
    u_int a, b, GCD;
    while(std::cin >> a >> b){
            GCD = get_GCD(a, b);
            std::cout << GCD << " " << get_LCM(a, b, GCD) << std::endl;
    }    

    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

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

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

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

int GCD(int a,int b);
int LCM(int a,int b);

int main()
{
	int a,b,gcd,lcm;

	while(cin>>a>>b)
	{
		if(a==0 || b==0)
			cout<<"0 0"<<endl;
		gcd=GCD(a,b);
		lcm=LCM(a,b);
		cout<<gcd<<' '<<lcm<<endl;
	}
}

int GCD(int a,int b)
{
	while(a!=b)
		if(a>b) a=a-b;
		else    b=b-a;
	return a;
}
int LCM(int a,int b)
{
	return ((a*b)/GCD(a,b));
}

//大文字を小文字に変換
/*
for(int i=0;i<inp.size();i++)
if(inp[i]>='A' && inp[i]<='Z')
inp[i]+='a'-'A';
*/

C++: #include <iostream>

int gcd(int a, int b);
int lcm(int a, int b);

int main(){
	int a, b;
	while(std::cin >> a >> b){
		std::cout << gcd(a, b) << " " << lcm(a, b) << std::endl;
	}
    return 0;
}

//Greatest Common Divisor
int gcd(int a, int b){
	while(a != b){
		if(a > b) a = a - b;
		else b = b - a;
	}
	return a;
}

//Least Common Multiple
int lcm(int a, int b){
	return((a / gcd(a, b)) * b);
}

C++: #include<stdio.h>
int main(){
	long int a,b,x,y;
	scanf("%ld%ld",&a,&b);
	x=a;
	y=b;
	while(a!=b){
		if(a>b){a-=b;}
		else {b-=a;}
	}
	printf("%ld %ld",a,x/a*y);
	return 0;
}

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

void swap(long long int *a, long long int*b) {
	long long int x;
	x = *a;
	*a = *b;
	*b = x;
}

int GetGCD(long long int a, long long int b) {
	if (b > a) { swap(&a, &b); }
	while (a%b != 0) {
		a = a%b;
		swap(&a, &b);
	}
	return b;
}

int main() {
	long long int a, b, GCD, LCM;
	while (cin >> a>> b) {
		GCD = GetGCD(a, b);
		LCM = a*b / GCD;
		cout << GCD << " " << LCM << endl;
	}
}

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

int main(){
  int a,b,c,a2,b2;
  while(cin>>a>>b){
    a2=a;
    b2=b;
    while(1){
      if(a2%b2==0)break;
      else {
	c=a2%b2;
	a2=b2;b2=c;
      }
    }
    c=b2;
    c*=a/b2;
    c*=b/b2;
    cout <<b2<<" "<<c<<endl;
  }
  return 0;
}