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++: // #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (???test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// ??\??????push_back(d)???array[d]???????????????1?????§?????????
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN(){T d;cin>>d;return d;}
// ?????§??¬?´???°???Greatest Common Divisor???
LL gcd(LL a, LL b){ return (b > 0) ? gcd(b, a%b) : a; }
// ????°???¬?????°???Least Common Multiple???
LL lcm(LL a, LL b){ return a / gcd(a, b) * b; }

// ------------------- include, typedef, define END. -------------------

int main(){
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//??????????????????????????????.
	LL a,b;
	while(cin >> a >> b)
		cout << gcd(a,b) << " " << lcm(a,b) << endl;	

	return 0;
}

C++: #include <cstdio>

using namespace std;

int a, b;
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

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

C++: #include <stdio.h>

int main(){

	int a=0, b=0,i=0,m=0,n=0,B=0,A=0;

	scanf("%d%d", &a, &b);
	B = b;
	A = a;
	if (a < b){
		i = a;
		a = b;
		b = i;
	}

	while(1){

		n = a%b;
		if (n == 0){
			printf("%d ",b);
			break;
		}
		m = n;
		n = b%m;
		b = m;
	}
	m = A*B;
	m /= b;

	printf("%d\n", m);

	return 0;
}

C++: #include <iostream>
#include <boost/math/common_factor_rt.hpp>
using namespace std;
using namespace boost::math;

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

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

using namespace std;
int solveGCD(int a, int b);

int a, b, tmp;

int main() {
  while(1) {
    scanf("%d %d", &a, &b);
    if(a<b) {tmp=a; a=b; b=tmp;}
    int gcd = solveGCD(a, b); 
    printf("%d %d\n", gcd, a/gcd*b);
  }
}

int solveGCD(int a, int b) {
  return b ? solveGCD(b, a%b) : a;
}

C++: #include <cstdio>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <sstream>
using namespace std;

#define PQ priority_queue
#define P pair<int,int>
#define CLA(array) memset(array,0,sizeof array)
#define CLINF(array) memset(array,0x3f,sizeof array)
#define CLF(array) memset(array,-1,sizeof array)
#define DB(a) cout << "DEBUG " << a << endl;
typedef long long LL;
const int MAXN = 100000 + 50;
const int INF = 1 << 30;
LL gcd(LL a,LL b){
	if(a < b) swap(a,b);
	return b == 0 ? a : gcd(b,a % b);
}

int main(){
    //ios_base::sync_with_stdio(false);
	LL n,m;
	while(~scanf("%lld%lld",&n,&m)){
		LL ans = gcd(n,m);
		printf("%lld %lld\n",ans,n / ans * m);
	}


    return 0;
}

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

typedef long long ll;

ll gcd(ll a, ll b) {
    if(b == 0) return(a);
    return(gcd(b, a % b));
}
ll lcm(ll m, ll n) {
    if(m == 0 || n == 0) return(0);
    return(m * n / gcd(m, n));
}
int main(void) {
    int a, b;
    
    while(scanf("%d %d", &a, &b) != EOF) {
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
    
    return(0);
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	long long a, b;
	while (cin >> a >> b){
		long long gcd;
		long long c = max(a, b);
		long long d = min(a, b);
		while (true){
			if (c % d == 0) {
				gcd = d;
				goto C;
			}
			else{
				c -= d;
				swap(c, d);
			}
		}
	C:
		cout << gcd << ' ' << a*b / gcd << endl;
	}
}

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

int main(){
	int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(true){
		if(a==0||b==0)break;
		int tmp=a;
		a=b;
		b=tmp%a;
		if(a<b){
		b=1;
		break;
		}
		if(a%b==0)break;
	}
	if(a==0)a=1;
	if(b==0)b=1;
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

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

int main(){
	long long int x, y;
	while (cin >> x >> y) {
		long long int a, b, c;
		a = max(x, y);
		b = min(x, y);
		c = a % b;
		while (c) {
			a = b;
			b = c;
			c = a % b;
		}
		cout << b << ' ' << x * y / b << endl;
	}
	return 0;
}

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

int main(){
	int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(true){
		int tmp=a;
		a=b;
		if(a!=0)b=tmp%a;
		if(a<b){
		b=1;
		break;
		}
		if(a%b==0)break;
	}
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: /*
  GCD and LCM
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;

int n,m;

int gi() {
  int x=0,o=1; char ch=getchar();
  while(ch!='-' && (ch<'0' || ch>'9')) ch=getchar();
  if(ch=='-') o=-1,ch=getchar();
  while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
  return o*x;
}

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

int main() {
  while(scanf("%d%d", &n, &m)!=EOF) {
    int g=gcd(n,m);
    printf("%d %d\n", g,n/g*m);
  }
  return 0;
}

C++: #include<stdio.h>
int main(){

	long long int a,b,x,y;
	while(~scanf("%lld%lld",&a,&b))
	{
	x=a;
	y=b;
	while(a!=b){
		if(a>b){
			a-=b;
		}
		else{
			b-=a;
		}
	}
	printf("%lld %lld",a,x/a*y);
}	
return 0;
	}

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

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

C++: #include<iostream>
using namespace std;
int gcd(int a,int b)
{
	return a==b?a:gcd(b,a%b);
}
int main()
{
	int a,b,d;
	cin>>a>>b;
	d=gcd(a,b);
	cout<<d<<" "<<a/d*b;
	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(){
	int a, b;
	while((scanf("%d%d",&a,&b))!=EOF){
		int c=gcd(a, b);
		int d=(a/c)*b;
		printf("%d %d\n",c,d);
	}
}

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