Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

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

int main(){
const int INF=100;
int a[2];
int GCD,LCM;
while(cin>>a[0]>>a[1]){
for(int i=0;i++;i<INF){
a[0]%=a[1];
if(a[0]==0){
GCD=a[1];
break;}
a[1]%=a[0];
if(a[1]==0){
GCD=a[0];
break;}}
LCM=a[0]*a[1]/GCD;
cout<<GCD<<" "<<LCM<<endl;}}

C++: #include <iostream>
#include <fstream>
#include <cstdio>
#include <math.h>
#include <limits>
using namespace std;

int main() {
	long long x;
	long long y;
	long long g;
	while (1) {
		cin >> x;
		cin >> y;
		g=x*y;
		while (x*y!=0) {
			if (x>y) {
				x=x%y;
			}
			else {
				y=y%x;
			}
		}
		if (x==0) {
			x=y;
		}
		cout << g/x << " " << x << "\n";
	}
	return 0;
}

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

using namespace std;

long long int find_GCD(long long int a, long long int b){
  long long int max = 0;
  for(int i=min(a, b);i>0;i--){
    if(a%i==0 && b%i==0){
      max = i;
      break;
    }
  }
  return max;
}

long long int find_LCM(long long int a, long long int b){
  long long int LCM;
  for(int i=max(a, b);i<=a*b;i+=max(a, b)){
    if(i%a==0 && i%b==0){
      break;
    }
  }
}

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

    long long int GCD;
    long long int LCM;
    LCM = find_LCM(a, b);
    GCD = a*b/LCM;
    cout << GCD << " " << LCM << endl;
  }

}

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

ll gcd(ll p, ll q){
    if(q==0) return p;
    else return gcd(q, p%q);
}

ll lcm(ll p, ll q){
    ll g = gcd(p, q);
    return p/g*q;
}

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

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

int main(){
	long a, b, dmy, t, gcd, lcm;
	while( scanf("%d%d",&a,&b)!=EOF ){
		t=a*b;
		while(a!=b){
			while(a>b) a-=b;
			while(a<b) b-=a;
		}
		gcd=a;

		lcm=t/gcd;
		printf("%d %d\n",gcd, lcm);
	}
	exit(0);
}

C++: #include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <string>

using namespace std;
int main()
{
 int x,y,n,a,b;
 while(cin>>x>>y)
 {
  a=x;
  b=y;
  while(x%y!=0)
  {
   n=x%y;
   x=y;
   y=n;
  }
 cout<<y<<" "<<a*b/y;
 }
return 0;
}

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

C++: #include <stdio.h>
int main(void){
    int a,b,d,n,m;
    while(~scanf("%d%d",&a,&b)){
        n=a,m=b;
        while(b>0)d=a%b,a=b,b=d;
        printf("%d %d\n",a,n/a*m);
    }
    return 0;
}

C++: #include <iostream>
 
typedef unsigned int ui;
 
void swap(ui & a, ui & b)
{
    unsigned int tmp = a;
    a = b;
    b = tmp;
}
 
ui gcd(ui a, ui b)
{
    if (a < b) swap(a, b);
 
    ui c = a % b;
    while (c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
 
    return b;
}
 
int main() {
    using namespace std;
 
    ui a, b;
    while (cin >> a >> b) {
        const ui GCD = gcd(a, b);
        const ui LCM = a * (b / GCD);
        cout << GCD << ' ' << LCM << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int a, int b){
	int t;
	if(a < b){t=a;a=b;b=t;}
	t = b;
	b = a % b;
	a = t;
	if(b == 0){
		return a;
	}else{
		gcd(a,b);
	}
}
int lcm(double a, double b){
	return (a * b) / (gcd(a,b));
}
int main(){
	int a,b;
	while(cin >> a >> b)
	cout << gcd(a,b) << ' ' << lcm(a,b) << '\n';
	return 0;
}

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

void GetGCD(int a, int b, int& GCD)
{
	if(a == 0){
		GCD = b;
		return;
	}
	if(b == 0){
		GCD = a;
		return;
	}
	if(a >= b){
		a = a % b;
	}else{
		b = b % a;
	}
	GetGCD(a, b, GCD);
}

int main()
{
	while(true){
		int a, b;
		cin >> a >> b;
		if(cin.eof()) break;
		int GCD;
		GetGCD(a, b, GCD);
		int LCM = a * (b / GCD);
		cout << GCD << ' ' << LCM << endl;
	}
	return 0;
}

C++: #include <cstdio>

//input
int a, b;

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

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

void solve(){
	printf("%d %d\n", gcd(a, b), lcm(a, b));
}

int main(int argc, char const *argv[]){

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

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(void)
{
    int a,b,fl;
    while(cin>>a>>b)
    {
        fl=0;
        for(int i=1;fl==0;i++)
        {
            if(a%i==0&&b%(a/i)==0)
            {
                cout<<a/i<<" ";
                fl++;
            }
            else;
        }
        fl=0;
        for(int i=1;fl==0;i++)
        {
            if((a*i)%b==0)
            {
                cout<<a*i<<endl;
                fl++;
            }
            else;
        }
    }
    return 0;
}

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

using namespace std;

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

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

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

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

int main()
{
 while(1){
	int a,b;
	cin>>a>>b;

	if(cin.eof()) break;
	if(a==0||b==0)break;
	
	int g=gcd(a,b);
	cout<<g<<' '<<a/g*b<<endl;
 }
 return 0;
}

C++: #include <stdio.h>
int gcd(long long int x,long long int y)
{
    long long int tem;
    while(y!=0)
    {
        tem=y;
        y=x%y;
        x=tem;
    }
    return x;
}
int main()
{
    long long int a,b,x,y,l,g;
    while(scanf("%lld%lld",&a,&b)==2)
    {
        g=gcd(a,b);
        l=(a*b)/g;
        printf("%lld %lld\n",g,l);
    }
    return 0;
}

C++: /*
 0005-GCD_and_LCM.cpp
 
 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005
 */

#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int a,b;
    while(cin>>a>>b){
        long int temp_a = a;
        long int temp_b = b;
        while(1){
            long int l = max(temp_a,temp_b);
            long int r = min(temp_a,temp_b);
            l = l-r;
            if(l==r){
                cout<<l<<" "<<a/l * b/l * l <<endl;
                break;
            }else{
                temp_a = l;
                temp_b = r;
            }
        }
    }
}

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


long long int GCM(long long int a,int long long b){
	while(a!=b){
		a>b? a-=b:b-=a;
	}
	return a;
}

int main()
{
	ifstream ifs("Text.txt");
	long long int a,b,L,G;
	
	
	ifs>>a;
	do{
	ifs>>b;
	G=GCM(a,b);
	L=a*b/G;
	cout<<G<<" "<<L<<endl;
	}while(ifs>>a);
	cin>>a;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
#define int long long

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

unsigned main(){
    int A,B;
	while(cin>>A>>B){
		printf("%lld %lld\n",gcd(A,B),A*B/gcd(A,B));
	}
    return 0;
}