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>
#include<utility>

int main(){
  unsigned int a,b,tmp,GCD;
  while ( std::cin >> a >> b){
   unsigned long int LCM = a;
    if( b > a )std::swap( a , b );
    GCD = b;
    while(a % GCD != 0){
      tmp = a % GCD;
      a = GCD;
      GCD = tmp;
    }
    LCM = ( LCM / GCD ) * b;
    std::cout << GCD << " " << LCM << std::endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y){
	if(y == 0) return x;
	else return gcd(y, x % y);
}

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

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

using namespace std;

int a,b;

void search(int t)
{
	int r;
	
	if(r==0)
		return;
	
	if(t==1)
	{
		r=a%b;
		a=r;
		search(t=0);
	}
	else
	{
		r=b%a;
		b=r;
		search(t=1);
	}
	
}

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

int main()
{
	int a2,b2;
	
	for(;cin >> a;)
	{
		cin >> b;
/*		a2=a;
		b2=b;
		
		a=max(a2,b2);
		b=min(a2,b2);
		
		search(1);
		
		a=max(a,b);
		
		cout << a << " " << a2*(b2/a) << endl;
*/
		int gcd = GCD( a, b );
		cout << gcd << " " << a/gcd * b << endl;
	}
}

C++: #include <iostream>

using namespace std;

int gcd(long long a, long long b) {
  while (!a == 0 && !b == 0) {
    if (a >= b) {
      a %= b;
    } else {
      b %= a;
    }
  }
  if (a == 0) {
    return b;
  } else {
    return a;
  }
}

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

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<ll> vecll;
typedef vector<string> vecs;
template<class T,class U> using Hash=unordered_map<T,U>;

#define REP(i, a, n) for(ll i = a; i < (ll)n; i++)
#define RREP(i, a, n) for(ll i = n-1; i >= (ll)a; i--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, 0, n)
#define MD 1000000007

template<class T> T read(){T a;cin >> a;return a;}
template<class T> void read(T& a){cin >> a;}
template<class T, class ...Args> void read(T& a, Args&... args){cin >> a; read(args...);} 
template<class T> void rarr(T a, int n){for(int i = 0; i < n; i++) {cin >> a[i];}}
template<char c = ' ',class T> void write(T a){cout << fixed << setprecision(4) << a << endl;}
template<char c = ' ',class T,class ...Args> void write(T a, Args... args){cout << fixed << setprecision(4) << a << c; write<c>(args...);}
template<class T> void warr(vector<T> a, const char* c = " "){cout << a[0];for(int i = 1; i < (int)a.size(); i++)cout << c << a[i];cout << endl;;}
template<class T> void warr(T a, int n, const char* c = " "){cout << a[0];for(int i = 1; i < n; i++)cout << c << a[i];cout << endl;}
void split(string s, string delim, veci& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(atoi(s.substr(pos).data()));break;}else {result.push_back(atoi(s.substr(pos, p - pos).data()));}pos = p + delim.size();}}
void split(string s, string delim, vecs& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(s.substr(pos));break;}else {result.push_back(s.substr(pos, p - pos));}pos = p + delim.size();}}
ll gcd(ll a, ll b){while(true){ll k = a % b;if(k == 0)return b;a = b;b = k;}}
ll comb(ll n, ll m){ll p=1;m=min(m,n-m);for(ll i=1;i<=m;i++){p*=n-i+1;p/=i;}return p;}

int main(void)
{
    while(!cin.eof()){
        ll a,b;
        read(a,b);
        ll r1=gcd(a,b);
        ll r2=a*b/r1;
        write(r1,r2);
    }
    return 0;
}

C++: #include<iostream>
int GCD(long long int x,long long int y){
	while(x%y!=0){
		long long int z=x%y;
		x=y;
		y=z;
	}
	return y;
}
int main(){
	long long int a=0,b=0;
	while(std::cin>>a>>b){
		int c=GCD(a,b);
		long long int d=a*b/c;
		std::cout<<c<<" "<<d<<std::endl;
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

void keisann(int a, int b) {
	long long ac = a;
	long long bc = b;
	bool d = true;
	do {
		a = a%b;
		if (a == 0) {
			cout << b << " ";
			cout << ac*bc/ b << endl;
			d = false;
			continue;
		}
		b = b%a;
		if (b == 0) {
			cout << a << " ";
			cout << ac*bc / a << endl;
			d = false;
			continue;
		}
	} while (d == true);
}

int main()
{
	int a, b;
	while (cin >> a>>b,a!=EOF) {
		if (a > b) { keisann(a, b); }
		else if (a < b) {
			int c = a;
			a = b;
			b = c;
			keisann(a, b);
		}
		else if (a == b) {
			cout << "1" << " " << a << endl;
		}
	}
	return 0;
}

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

int main(){
	long a,b,tmp,i;
	
	while(cin>>a>>b){
		if(a>=b) i=b;
		else i=a;
		
		for(;0!=(a%i)+(b%i);i--);
		cout<<i<<" "<<a*b/i<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

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

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

int main()
{
    int a,b;
    while(scanf("%d%d",&a,&b) > 0){
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
    return 0;
}

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

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

   int main(void){
   int a,b;
   while(cin >> a >> b) {
      int lcm = a/gcd(a,b)*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 gcd(b, a % b);
    }else{
        return a;
    }
}

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

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

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(a, b);
}

int main(int argc, char *argv[])
{
	long long a, b;
	while (cin >> a >> b)
	{
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}

	return 0;
}

C++: #include <stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
unsigned long int gcd(unsigned long int a,unsigned long int b)
{
 if(b==0)
 return a;
 else
 return gcd(b,a%b);

}
unsigned long int lcm(unsigned long int a,unsigned long int b)
{

 return a/gcd(a,b)*b;

}
int main() {
 unsigned long int a,b;

   while(cin>>a>>b)
   {
    

    cout<<gcd(a,b)<<" "<<lcm(a,b)<<"\n";
   }
    return 0;
}