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 _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion


// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
#pragma endregion


// ?´???°
#pragma region PRIME
bool is_prime(unsigned n) {
  switch(n) {
    case 0:
    case 1: return false;
    case 2: return true;
  }
  if (n%2==0) return false;
  for (unsigned i=3; i*i<=n; i+=2)
    if (n%i==0) return false;
  return true;
}
#pragma endregion


// ??§??????/?°?????????????
#pragma region TRANSFORM
void mutal_tr(string &s) {
  for(int i=s.size(); i--;) {
    if(islower(s[i])) s[i] = toupper(s[i]);
    else if (isupper(s[i])) s[i] = tolower(s[i]);
  }
}
void to_upper(string &s) { for(int i=s.size(); i--;) s[i] = toupper(s[i]); }
void to_lower(string &s) { for(int i=s.size(); i--;) s[i] = tolower(s[i]); }
#pragma endregion


// ??????
#pragma region SET
template<class T>
set<T> intersection(const set<T>& sa, const set<T>& sb) {
  set<T> ret;
  for(T a : sa) if(sb.find(a) != sb.end()) ret.insert(a);
  return ret;
}
#pragma endregion

// Union Find
#pragma region UF
struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) {}
  bool union_set(int x, int y) {
    x = root(x); y = root(y);
    if(x!=y) {
      if(data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool find_set(int x, int y) { return root(x) == root(y); }
  int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
  int size(int x) { return -data[root(x)]; }
};
#pragma endregion


// ?????°
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion

int gcd(int m, int n)
{
    if((0==m)||(0==n)) return 0;
    while(m!=n) {
        if(m>n) m = m - n;
        else n = n - m;
    }
    return m;
}

int lcm(int m, int n)
{
    if((0==m)||(0==n)) return 0;
    return((m/gcd(m,n))*n);
}

int main() {
    int a, b;
    while(cin>>a>>b) {
        printf("%d %d\n", gcd(a,b), lcm(a,b));

    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
main(){
	int n1,n2,a1,a2;
	while(cin>>n1>>n2){
		int mx=max(n1,n2);
		for(int i=mx;i>0;--i){
			if(n1%i==0 && n2%i==0){
				a1=i;
				break;
			}
		}
		int flag=1;
		for(int i=1;i<=10000,flag;++i){
			for(int j=1;j<=10000;++j){
			//cout<<n1*i<<" "<<n2*j<<endl;
				if(n1*i==n2*j){
					a2=n1*i;
					flag=0;
					break;
				}
			}
		}
		cout<<a1<<" "<<a2<<endl;
	}
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int main(){
int a,b,x,y;
float L,xx,yy,xxx;
while(cin>>a>>b){
x=a;y=b;
while(1){
  if(x==y){break;}
  else if(x==0)break;
  else if(y==0)break;
  else if(x<y){y=y-x;x=x-y;}
  else{x=x-y;y=y-x;}
}
xxx=x;
xx=a;yy=b;
L=(xx*yy)/xxx;
cout<<y<<" ";printf("%.0f",L);cout<<endl;
}
  return 0;
}

C++: #include<stdio.h>
int main(void)
{
	long int a,b,aa,ba,i,x,y,bb;
	aa=1;
	ba=1;
	while(scanf("%ld %ld",&a,&b)!=EOF){
		x=a;
		y=b;
		aa=1;
		ba=1;
		
		if(b<a){
			while(1){
				if(aa==0){
					break;
				}
				aa=a%b;
				a=b;
				b=aa;
			}
			ba=x*y/a;
			printf("%ld %ld\n",a,ba);
		}
		else{
			while(1){
				if(aa==0){
					break;
				}
				aa=b%a;
				b=a;
				a=aa;
			}
			ba=x*y/b;
			printf("%ld %ld\n",b,ba);
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} //配列vにn個の要素を入力する
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 

const int mod = 1000000007;
const int inf = 1e9;

int main(){
    while(1){
        int a = -1, b;
        cin >> a >> b;
        if(a == -1) break;
        cout << __gcd(a, b) << " " << (ll)a*b/__gcd(a,b)<< endl;
    }
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
while(i=0;i<=50;++i){
  cin>>a>>b;
x=a;y=b;
while(1){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
  else if(x==y){break;}
}
L=(a*b)/x;
if(x==1){cout<<y<<" "<<y<<endl;}
else{cout<<y<<" "<<L<<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;}return 0;}

C++: // B.cpp

#include <iostream>

using namespace std;

int gcd(int, int);
int lcm(int, int);

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

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a <= b){
		max = b, min = a;
	}
	if(min == 0) return max;
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = min(temp_a, temp_b);
		lcm = (a / gcd) * b;
		cout << gcd << " "<< lcm << endl;

	}

	//getchar();

	return 0;
}

C++: #include<stdio.h>
int main(){int a,b;while(scanf("%d%d",&a,&b))printf("%d %d\n",__gcd(a,b),__gcd(a,b)*b);return 0;}