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

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

int solve(int a, int b){
    int r;
    r = a % b;

    if(r == 0){
        return b;
    }else{
        return solve(b, r);
    }
}

int main(){
    int a, b;
    int gcd, lcm;

    while(cin >> a >> b){
        gcd = solve(a, b);
        lcm = a / gcd * b;

        cout << gcd << " " << lcm << endl;
    }

    return 0;
}

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

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

C++: #include <iostream>

using namespace std;

void gcd_lcm(int, int);

int main() {

	int a, b;

	while(cin >> a >> b) {
		gcd_lcm(a, b);
	}

}

void gcd_lcm(int a, int b) {
	int i=2, gcd=1;
	if(a<b) {
		int t=a;
		a=b;
		b=t;
	}

	while(i<=a) {
		if(a%i==0&&b%i==0) {
			gcd*=i;
			a/=i;
			b/=i;
			continue;
		}
		i++;
	}
	
	cout << gcd << " " << a*b*gcd << endl;
}

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

using namespace std;

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

}

C++: #include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
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 main(){
//	m*n = LCM * GCD
	unsigned long long m, n;
	while(cin >> m >> n){
		int LCM, GCD;
		
		if(m<n){
			int swap;
			swap = m;
			m = n;
			n = swap;
		}

		int m_, n_;
		m_ = m;
		n_ = n;
		do {
			if(n_==0){
				GCD = m_;
				break;
			}
			
			int swap = m_ % n_;
			m_ = n_;
			n_ = swap;
		} while(1);
		
		LCM = (m*n)/GCD;
		cout << GCD << " " << LCM << endl;
	}

	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,g,l;
	while(cin>>a>>b){
		g=gcd((a>=b)?a:b,(a>=b)?b:a);
		l=(a/g)*b;
		cout<<g<<" "<<l<<endl;
	}
	return 0;
}

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

using namespace std;

int GCD(int a, int b){
	if(a < b){
		swap(a, b);
	}
	while(b){
		a %= b;
		swap(a, b);
	}
	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;
	}
	return 0;
}

C++: #include<stdio.h>
int main(){
  long long int r,temp,x,y;
  while(scanf("%lld",&x)!=EOF){
    scanf("%lld",&y);
    if(x<y){
      temp=x;
      x=y;
      y=temp;
    }
    long long int a=x;
    long long int b=y;
    while(y!=0){
      r=x%y;
      x=y;
      y=r;
    }
    long long int lcm=a*b/x;
    printf("%lld %lld\n",x,lcm);
  }
  return(0);
}

C++: #include<stdio.h>
#define LL long long
LL GCD(LL a,LL b)
{
    return b==0?a:GCD(b,a%b);
}
int main()
{
    LL a,b;
    while(scanf("%lld%lld",&a,&b)!=EOF)
    {
        LL c=GCD(a,b);
        printf("%lld %lld\n",c,a/c*b);
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

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

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

void solve()
{
	unsigned long long int a, b;
	while(cin >> a >> b)
	{
		if(a < b)
		{
			unsigned long long int temp = a;
			a = b;
			b = temp;
		}
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

int main(){
  int a, b;

  while(cin >> a >> b){
    int a_lcm = a, b_lcm = b;
    while(a!=0 &&b!=0){
      if(a < b)
	swap(a,b);
      int tmp = b;
      b = a%b;
      a = tmp;
    }
    cout << a << " " << a_lcm/a*b_lcm << endl;

  }
  
  return 0;
}

C++: /* 2012-07-08T09:04:13 */
#define DEBUG_ON
#define CONDITION true
using namespace std;/*{{{*/

#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/time.h>
#include <vector>

#define INF (1e9)
static const double PI (3.14159265358979323846);
static const double EPS (1e-10);

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef complex<double> P;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
inline double now(){ struct timeval tv; gettimeofday(&tv, NULL); return ((double)(tv.tv_sec) + (double)(tv.tv_usec) * 1e-6); }

#define FOR(i, b, e) for (typeof(b) i = (b); assert((i) <= (e)), i != (e); ++i)
#define REP(i, n) FOR(i, 0, n)

#define IFC(c) if(c) continue;
#define IFB(c) if(c) break;
#define IFR(c, r) if(c) return r;

#define OPOVER(_op, _type) inline bool operator _op (const _type &t) const

#define arrsz(a) ( sizeof(a) / sizeof(a[0]) )

#define F first
#define S second
#define MP(a, b) make_pair(a, b)

#define SZ(a) ((ll)a.size())
#define PB(e) push_back(e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(c,it) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define EXIST(s,e) ((s).find(e)!=(s).end())

#define BIT(n) (1ULL << (n))
#define BITOF(n, m) ((n) >> (m) & 1)

#define RANGE(a, b, c) ((a) <= (b) && (b) <= (c))

#ifdef DEBUG_ON
#define dprt(fmt, ...) if (CONDITION) fprintf(stderr, fmt, __VA_ARGS__)
#define darr(a) if (CONDITION) copy( (a), (a) + arrsz(a), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define darr_range(a, f, t) if (CONDITION) copy( (a) + (f), (a) + (t), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define dvec(v) if (CONDITION) copy( ALL(v), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define darr2(a, n, m) if (CONDITION) FOR(i, 0, (n)){ darr_range( (a)[i], 0, (m) ); }
#define dvec2(v) if (CONDITION) FOR(i, 0, SZ(v)){ dvec( (v)[i] ); }
#define WAIT() if (CONDITION) { string _wait_; cerr << "(hit return to continue)" << endl; getline(cin, _wait_); }
#else
#define cerr if(0) cerr
#define dprt(fmt, ...)
#define darr(a)
#define darr_range(a, f, t)
#define dvec(v)
#define darr2(a, n, m)
#define dvec2(v)
#define WAIT()
#endif
/*}}}*/

ll lcm(ll a, ll b)
{
	if (a == 0 || b == 0) {
		return 0;
	}
	if (a < b) {
		swap(a, b);
	}
	ll am = a, bm = b;
	while (true) {
		if (am == bm) {
			return am;
		}
		if (bm > am) {
			swap(a, b);
			swap(am, bm);
		}
		bm += b;
	}
}

ll gcd(ll a, ll b)
{
	if (a == 0 || b == 0) {
		return 0;
	}
	if (a < b) {
		swap(a, b);
	}
	while (true) {
		if (a % b == 0) {
			return b;
		}
		ll buf = a;
		a = b;
		b = buf % b;
	}
}

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