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\n", G, L)
	}
}

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(true){
		int a,b;
		cin >> a >> b;
		
		if(cin.eof()) break;
		
		int g = gcd(a,b);
		cout << g << ' ' << a/g*b << endl;
		
	}
	
	return 0;
	
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<cstring>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    int a,b;
    while(scanf("%d%d",a,b)!=EOF){
        
        if(b>a)swap(b,a);
        ll aa=a,bb=b;
        ll o,p,q;
        while(bb!=0){
            o=bb;
            p=aa%bb;
            aa=bb;bb=p;
        }
        ll i=1;
        while(true){
            i++;
            ll ao=a*i;
            if(ao%b==0){
                q=ao;
                break;
            }
        }
        cout<<o<<" "<<q<<endl;
    }
    
    
    
    
    return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	
	int a, b, c = 0;
	while (cin >> a, cin >> b)
	{
		for (int i = 1; i <= a, i <= b; i++)
		{
			if (a % i == 0 && b % i == 0)
			{
				c = i;
			}
		}
		cout << c << " " << a*b / c << endl;
	}
	getchar();
	getchar();
	return 0;
}

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

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

int lcm(int x,int y)
{
    return x/gcd(x,y)*y;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
      printf("%d %d\n",gcd(a,b),lcm(a,b));
    }
    //fclose(stdin);
    //fclose(stdout);
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	long long x , y , i , j , tmp , tmp2;
	while( cin >> x >> y ){
		long long n = x>y ? x:y;
		for( i=1 ; i<=n ; i++ ){
			if( x%i+y%i==0 )
				tmp = i ;
		}
		i=n;
		while(1){
			i++;
			if( i%x+i%y==0 ){
				tmp2=i;
				break;
			}
		}
		cout << tmp <<" "<< tmp2 << endl;
	}
}

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

int saidai(long  a,long  b){
	while(b != a){
		if(a > b){
			a -= b;
		}else {
			b -= a;
		}
	}
	return a;
}


int	saisyou( long  a,long b , long c){
	return a/c*b;
}

int main(){
	long  a,b;
	cin>>a;
	cin>>b;
	long ans = saidai(a,b);
	cout<<ans<<" "<<saisyou(a,b,ans);;
	return 0;

}

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

using namespace std;

int getGcd(int x, int y){
	int r;
	if(x==0 || y==0){
		return 0;
	}
	while( (r=x%y) != 0 ){
		x=y;
		y=r;
	}
	return y;
}

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

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

using namespace std;

int main()
{
    unsigned long x, y;
    
    while (cin >> x >> y)
    {
        unsigned long a = x, b = y;
        while (true)
        {
            unsigned long tmp = b;
            b = a % b;
            a = tmp;
            if (b == 0)
            {
                break;
            }
        }
        cout << a << " " << x / a * y << endl;
    }
    
    return 0;
}

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

int gcd(int a,int b){
	while(1){
		if(a<b)swap(a,b);
		if(!b)break;
		a%=b;
	}
	return a;
}

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

C++: #include <iostream>
using namespace std;
 
int main() {
	long a,b;
	while (cin>>a>>b){
		long c = a;
	    long d = b;
	while (true) {
		if(c % d == 0) break;
		long e = d;
		d = c % d;
		c = e;
	}cout<<d<<" "<<a*b/d<<endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <fstream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <ctime>
#include <iterator>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;


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

long long ppcm(long long a,long long b)
{
    return a*b/pgcd(a,b);
}

int main()
{
    long long a,b;
    while(cin>>a>>b)
    {
        cout<<pgcd(a,b)<<" "<<ppcm(a,b)<<endl;
    }
}

C++: #include <bits/stdc++.h>

using namespace std;

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

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

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

int saidai(long long int a,long long int b){
	while(b){
		int m=a%b;
		a=b;
		b=m;
	}
	
	return a;
}


int	saisyou( long long int a,long long int b ){
	return (a*b)/saidai(a,b);
}

int main(){
	long long int a,b;
	cin>>a;cin>>b;
	
	cout<<saidai(a,b)<<" "<<saisyou(a,b);;
	return 0;

}

C++: #include<iostream>

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

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

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

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

C++: #include<iostream>

void swap(int *x, int*y)
{
	int temp=0;

	temp = *x;

	*x = *y;

	*y = temp;
}

int main()
{
	int a=0, b=0, c=0, d=0;

	while(std::cin >> a >> b)
	{	
		c=a;

		d=b;//最小公倍数の計算のため保存

		if(a<b)
		{
			swap(&a,&b);
		}

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

			swap(&a,&b);

		}

		std::cout << b << ' ' << c/b*d << '\n';
	}
}

C++: #include <iostream>

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(b,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>
#include <cstdio>
using namespace std;


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

int main() {
    //freopen("0005.txt", "r", stdin);
    int a, b;
    while (cin >> a >> b) {
        int g = gcd(a, b);
        cout << g << " " << (a / g * b) << "\n";
    }
}

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

int main(){
int i = 0;int a = 0;int b = 0;int aa = 0;int bb = 0;
while(!cin.eof()){
cin >> a >> b;
if(a >= b){
aa = b;bb = a;
}
else{
aa = a;bb = b;
}
while(aa != 0){
int c = 0;
bb = bb % aa;
c = aa;
aa = bb;
bb = c;
}
int P = a * b;
cout << bb << " " << P / bb << endl;

}
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<iomanip>
using namespace std;
#define L long long int
L gcd(L a,L b){
	if(a<b){
		return gcd(b,a);
	}else if(a>b){
		return gcd(a-b,b);
	}else{
		return a;
	}
}

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

return 0;
}