Go: package main

import (
	"fmt"
)

func main() {
	var a, b int
	for {
		i, _ := fmt.Scan(&a, &b)
		if i == 0 {
			break
		}

		gcd := getGCD(a, b)
		fmt.Println(gcd, getLCM(a, b, gcd))
	}
}

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

func getLCM(a, b, gcd int) int {
	return a * b / gcd
}

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

int main() {
    int a, b;
    while (cin >> a >> b) {
        if (a > b) swap(a, b);
        int A = a, B = b;
        while ((a % A != 0) || (b % A != 0)) {
            --A;
        }
        while ((B % a != 0) || (B % b != 0)) {
            B += A;
        }
        cout << A << ' ' << B << endl;
    }
    
    return 0;
}

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

int gcd(int a, int b) {
    
  	longint p,q,r;
  	if(a>b){p=b;b=a;a=p;}
	while(r!=0){
	q=b/a;
	r=b%a;
	b=a;
	a=r;
	}
	return b;
}

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

C++: //কী পেয়েছো তুমি, কী চেয়েছিলে তুমি.? হিসেবটা তোমার বড়ই গড়মিল...!!//
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3F3F3F3F
typedef long long ll;
vector<ll>v;

int main ()
{
    ll n,m;
    while(scanf("%lld%lld",&n,&m)!=EOF){
        cout<<__gcd(n,m)<<" "<<(n*m)/__gcd(n,m)<<endl;
    }
}
/*
5 6
1 0
0 5
1 2
1 3
2 3
3 4
*/

C++: #include<iostream>
using namespace std;
typedef long long int ll;

ll GCD(ll,ll);
ll a, b, gcd, lcm, temp;

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

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

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

int LCG(int x, int y);

int main(){
 int a,b;
 int g;
 long l;
 while(cin >> a >> b){
    g = LCG(a,b);
    l = (long)a*b/g;
    cout << g << " " << l << endl;
 }
}

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

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int *a, *b, s, t;
	int p, q;
	a = &p;
	b = &q;
	while(cin >> p >> q){
		for(int i = (*a > *b)? *b : *a; i >= 1; i--){
			if(*b%i == 0 && *a%i == 0){
				cout << i << " ";
				break;
			}
		}
		s = *a;
		t = *b;
		while(s != t){
			if(s > t){
				while(s > t){
					t += *b;
				}
			} else {
				while(t > s){
					s += *a;
				}
			}
		}
		cout << s << endl;
	}
	
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
??
int main() {
????????int n, m;
????????while (2 == scanf("%d%d", &n, &m)) {
????????????????printf("%d %d\n", __gcd(n, m), n / __gcd(n, m) * m);
????????}
????????return 0;
}

C++: #include <cstdio>

using namespace std;

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

int main(){
    int a, b,gcd;
    long int lcm;
    while(true){
        scanf("%d%d",&a,&b);
        gcd = gcdr(a,b);
        //printf("%d\n",gcd);
        lcm = (long)gcd * a / gcd * b / gcd;
        printf("%d %ld\n",gcd,lcm);
    }
    
    return 0;
}

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

typedef long long int Long;

int gcd(Long a, Long b) {
  return b == 0 ? a : gcd(b, a%b);
}

int lcm(Long t, Long ab) {
  return ab / t;
}

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

C++: #include <iostream>

using namespace std;

int gcd(int x, int y)
{
	return y > 0 ? gcd(y, x % y) : x;
}

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

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

const long long zero = 0LL;
long long lcm, gcd;
long long GCD(long long,long long);

int main(){
	long long a,b;
	while( scanf(" %lld%lld",&a,&b)!=EOF ){
		gcd = GCD(a,b);
		lcm = a/gcd*b;
		printf("%lld %lld\n",gcd,lcm);
	}
}

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

C++: #include<stdio.h>
long long int x,y;
long long int m,n;
long long int ans1,ans2;

int GCD(long long int n,long long int m){
    if(n%m==0){
        return m;
    }
    return GCD(m,n%m);
}

int main(){
    while(1){
        if(scanf("%lld",&n)==-1)break;
        scanf("%lld",&m);
        if(n<=m){
            ans1=GCD(m,n);
        }
        else{
            ans1=GCD(n,m);
        }
        ans2=m*n/ans1;
        printf("%lld %lld\n",ans1,ans2);
    }
    return 0;
}

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

int main() {
	double a, b, c, d;
	while(1) {
		cin >> a >> b;
		c = a;
		d = b;
		while (1) {
			if (fmod(max(a, b), min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a -= b;
			}else b -=a;
		}
			cout << " " << c * d / a << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int gcd(int a,int b)
{
	if(b==0)
		return a;
	else 
		return gcd(b,a%b);
}
int main()
{
	long long a,b;
	while(cin>>a>>b)
	{
		long long i;
		if(a<b)
			swap(a,b);
		i=gcd(a,b);
		long long t=a*b/i;
		cout<<i<<" "<<t<<endl;
	}
	return 0;
}

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


int main()
{
	int a, b;
	while(cin>>a>>b)
	{
		int i = a;
		while (a%i != 0 || b % i != 0)
			i--;
		int j = a;
		while (i%a != 0 || i % b != 0)
			j++;
		cout << i << " " << j << endl;
	}
    return 0;
}

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 <utility>
#include <algorithm>
using namespace std;

int gcd(int a, int b) {
    int c=a%b;
    while(c) {
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    while(cin>>a>>b) {
        int g=gcd(a, b);
        int l=a/g*b;
        cout<<g<<' '<<l<<'\n';
    }
    return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;
int main()
{
	int  a, b,a1,b1,c,c1,g,l;
	cin >> a>>b;
	
	a1 = a;
	b1 = b;
	
	while (1)
	{
		c1 =c ;
		c = abs(a - b);
		if (c==0)
		{
			break;
		}
		
		if (a > b)
		{
			a = c;
			
			c1 = b + c;
		}
		else if (a<b)
		{
			
			b = c;
			
		}
	}
	g = c1;
	l = a1*b1 / g;
	cout << g << " " << l;

	
}

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

int setGcd(int a, int b) {
    int gcd;
    
    if(a == 0 || b == 0) return 0;
    
    while(a != b) {
        if(a > b) a -= b;
        else b -= a;
    }
    gcd = a;
    return gcd;
}

int setLcm(int a, int b) {
    int lcm;
    
    if(a == 0 || b == 0) return 0;
    lcm = a / setGcd(a,b) * b;
    
    return lcm;
}

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

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

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

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

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

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

int lcm(int a,int b){
	if(a<b){
		return lcm(a,b-a);
	}else if(a>b){
		return lcm(b,a-b);
	}else{
		return a;
	}
}

int main(){
int a,b,g;
while(cin>>a>>b){
	for(g=min(a,b);g>0;g--){
		if(a%g==0 && b%g==0)break;
	}
	cout<<g<<" "<<a*b/g<<endl;
}
return 0;
}