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<stdio.h>


//公約数の関数
int kouyakusuu_f(unsigned long long int a,unsigned long long int b)
{
	//返す変数
	int kouyakusuu_ans = 0;

	//無限ループ
	for (int i = a;;i -= 2)
	{
		//両方割れるなら
		if (a %i == 0)
		{
			if (b % i == 0)
			{
				kouyakusuu_ans = i;
				break;
			}
		}
	}

	return kouyakusuu_ans;
}



//公倍数の関数
unsigned long long int koubaisuu_f(unsigned long long int a,unsigned long long int b)
{
	//保存用変数(aとbをもう入れちゃう)
	unsigned long long int hozon1 = a,hozon2 = b;
	//インクリメント変数
	int count1 = 0,count2 = 0;

	//合うまで続ける
	while (hozon1 != hozon2)
	{
		//aのほうが小さいとき(bが大きい)
		while (hozon1 < hozon2)
		{
			count1++;
			//小さいaを少しずつ増やす
			hozon1 = a * count1;
		}
		//bの方が小さいとき(aが大きい)
		while (hozon2 < hozon1)
		{
			count2++;
			//小さいbを少しずつ増やす
			hozon2 = b * count2;
		}
	}

	//どうせ同じだからどっちでも問題ない
	return hozon1;
}




int main(void)
{
	//公倍数と公約数
	unsigned long long int kouyakusuu = 0;
	unsigned long long int koubaisuu = 0;
	//入力
	int a = 0,b = 0;

	//回しまくる
	while (scanf("%d %d",&a,&b) != EOF)
	{
		//同じ値ならそのマンまでいいでしょう
		if (a != b)
		{
			//公約数を関数よりもとめる
			kouyakusuu = kouyakusuu_f(a,b);
			//公倍数を関数により求める
			koubaisuu = koubaisuu_f(a,b);
		}
		//同じ値ならそのまま
		else
		{
			koubaisuu = a;
			kouyakusuu = a;
		}
		//表示
		printf("%llu %llu\n",kouyakusuu,koubaisuu);
	}

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
 long long int a, b, c, temp, min, A, B;
 while(cin >> a >> b){
  if(a < b){
    temp = a;
    a = b;
    b = temp;
  }

    
  else if (a > b){
    A = a;
    B = b;

    while(1){
      c = A % B;
      if(c == 0) break;
      else if(c != 0){
        A = B;
        B = c;
      }
    }
    min = (a * b) / B;
    cout << B << " " << min << endl;
  }
  else if(a == b){
    cout << a << " " << a << endl;
  }
  else if(a == 0){
    cout << "0" << " " << "0" << endl;
  }
  else if(b == 0){
    cout << "0" << " " << "0" << endl;
  }
 }
 return 0; 
}

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

using namespace std;

int gcd(int a, int b) {
  for(int t; t = a % b; a = b, b = t);
  return b;
}

int main() {
  int a, b, g;
  long long l;
  while(scanf("%d%d", &a, &b) != EOF) {
    g = gcd(a, b);
    l = 1ll * a * b / g;
    printf("%d %lld\n", g, l);
  }
  return 0;
}

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

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

void solve(int a, int b){
  if(a < b)
    swap(a, b);
  int gcd = GCD(a, b);
  cout << a / gcd * b << " " << gcd << endl;
}

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

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

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

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

int GCD(int a, int b)
{
    int temp;
    while(temp!=0)
    {
      temp=a%b;
      a=b;
      b=temp;
    }
    return a;
}
int main()
{
    int a,b,lcm,gcd;
    while(1)
    {
    cin>>a>>b;
    gcd=GCD(a,b);
    lcm=a*b/gcd;
    cout<<gcd<<" "<<lcm<<"\n";

    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<set>
#include<bitset>
#include<map>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#define INF 0x3f3f3f3f
#define inf 100000000000000000
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
int a,b,temp;
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;
}
int main()
{
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        if(a<b)
        {
            temp=a;a=b;b=temp;
        }
        printf("%d %d\n",gcd(a,b),lcm(a,b));
    }
    return 0;
}

C++: #include <cstdio>

using namespace std;
int gcd(int x, int y) {
	while(y) {
		int t = x%y;x=y;y=t;
	}
	return x;
}

int main() {
	while(true) {
		int a,b;
		if(scanf("%d%d", &a, &b)<2)break;
		int g = gcd(a,b);
		int l = a/g*b;
		printf("%d %d\n", g, l);
	}
	return 0;
}

C++: #include <iostream>
long gcm(long a,long b){
	if (b==0) return a;
	return gcm(b,a%b);
}
 
int main(void){
	long a,b,x;
	while (std::cin>>a>>b){
		x=gcm(a,b);
		std::cout<<x<<" "<<a/x*b<<"\n";
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a,b;
	while (cin >> a >> b){
		int g=__gcd(a,b);
		int l=(a/g)*b;
		cout << g << " " << l << endl; 
	}
	return 0;
}

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

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

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

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

int main(){
	int a = 0;
	int b = 0;
	int max = 0;
	int min = 0;
	int d = 1;
	int a_bk = 0;
	int b_bk = 0;

	while (cin >> a >> b) {
		if (a > b) {
			max = b;
			min = a;
		}
		else {
			max = a;
			min = b;
		}

		a_bk = a;
		b_bk = b;
		d = 1;

		for (int c = 2; c <= max ; c++) {
			while(a%c == 0 && b%c == 0) {
				a /= c;
				b /= c;
				d *= c;
				
			}
		}
		cout << d;

		a = a_bk;
		b = b_bk;

		for (min; min <= 2000000000; min++) {
			if (min%a == 0 && min%b == 0) {
				cout << min << "\n";
				break;
			}
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std; 

int main() 
{    int a,b,m,n,r,t;
   
  while(scanf("%d%d",&a,&b)!=EOF)
{  
	if(a<b)
	{    t=b;
	     b=a;
		 a=t;
	}
	m=a;
	n=b;
	while((r=a%b)!=0)
	{   a=b;
	    b=r;
	}
	cout<<b<<" "<<m/b*n<<endl;

	
}
	return 0;
}

C++: #include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


ll a, b;

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