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

using namespace std;

typedef long long ll;

ll getLCM(ll a, ll b){
	if (a < b) { swap(a, b); }
	while (a % b) {
		a = a % b;
		swap(a, b);
	}
	return b;
}

int main(){
	ll a, b, A, B;
	ll gcd, lcm;
	for (; cin >> a >> b; cout << lcm << " " << gcd << endl) {
		lcm = getLCM(a, b);
		gcd = a * b / lcm;
	}
	return 0;
}

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

//最大公約数
int gcd(int a, int b)
{
    int r;
    while((r = a % b) != 0) 
    {
        a = b;
        b = r;
    }
    return b;
}


//最小公倍数
int lcm(int a, int b)
{
    return (a * b / gcd(a,b));
}



int main(){

int a,b;

while(cin >> a >> b){
    if(a == -1 or b == -1)  break;
   while(a <= 0 or a>2000000000 or b <= 0 or b > 2000000000){
       cin >> a >> b;
   }
   if(a > 0 and b > 0){
        cout << gcd(a,b) << " "<< lcm(a,b)<< "\n";
    }
}

return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b){if(a%b==0)return b;return gcd(b,a%b);}
int lcm(int a,int b){int c=gcd(a,b);return ((a/c)*(b/c)*c);}
int main(){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		cout << gcd(a,b) << " " << lcm(a,b) << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
int a,b,i,x,y;
while(cin>>a>>b){
int max=0,min;
i=1;
x=a;
y=b;
while(i!=0){
i=x%y;
x=y;
y=i;
}
max=x;
min=(a/max)*b;
cout<<max<<" "<<min<<endl;
}
return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	long long a,b,yakuans,baians;
	while(cin>>a>>b){
		if(a>b)swap(a,b);
		for(int i=2;i<=a;i++){
			if((a/i)*i==a){
				if((b/i)*i==b){
					yakuans=i;
				}
			}
		}
		baians=(a*b)/yakuans;
		cout<<yakuans<<" "<<baians<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int a, b;

  function<int(int, int)> gcd = [&](int a, int b) {
    if (a % b == 0) return b;
    return gcd(b, a % b);
  };
  function<int(int, int)> lcm = [&](int a, int b) {
    return a / gcd(a, b) * b;
  };

  while (cin >> a >> b) {
    cout << gcd(a, b) << " " << lcm(a, b) << '\n';
  }
}

C++: #include <iostream>
#include<stdio.h>
#define MAX_N 100005
#include<string>
typedef long long ll;
using namespace std;
ll gcd(ll a,ll b){
    if(b == 0){return a;}
    else{
        gcd(b,a%b);
    }
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);

}
int main(){
    ll 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(a==0)
        return b;
    return gcd(b%a,a);
}
long long lcm(long long a, long long b)
{
    return (a*b)/gcd(a,b);
}
int main()
{
    long long x,y;
    while(cin>>x>>y)
    {
        cout<<gcd(x,y)<<" "<<lcm(x,y)<<endl;
    }
}

C++: #include <iostream>
using namespace std;
int gcd(int a, int b) {
	if (a%b) {
		return gcd(b,a%b);
	}else {
		return b;
	}
}
int main() {
	int a = 0;
	int b = 0;
	int max = 0;
	int d = 0;

	while (cin >> a >> b) {
		if (a > b) {
			max = b;
		}
		else {
			max = a;
		}
		d = gcd(a, b);
		a = a / d * b;
		cout << d << ' ' << a << "\n";
	}
	return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
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();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

int lcm(int a, int b) {
	if(!a&b) return 0;
	else 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 <iostream>
int gcd(int a , int b){
    return (b == 0)? a : gcd(b , a % b);
}
int main(){
    int a , b;
    while(std::cin >> a >> b){
        int x = gcd(a , b);
        std::cout << x << " " << x * (int)(a / x) * (int)(b / x) << "\n";
    }
}

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

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

int gcd(int u, int v) {
  int r;
  while (0 != v) {
    r = u % v; u = v; v = r; /* swap */
  }
  return u;
}

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

    return 0;
}