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;

void calcGCDLCM(unsigned int in1, unsigned int in2,
    unsigned int* GCD, unsigned int* LCM) {
  unsigned int num1, num2;
  unsigned int denom=2;
  unsigned int tempGCD=1;

  if(in1>in2) {
    num1=in2;
    num2=in1;
  } else {
    num1=in1;
    num2=in2;
  }

  while(denom <= num1) {
    if(num1 % denom == 0 && num2 % denom == 0) {
      tempGCD *= denom;
      num1 /= denom;
      num2 /= denom;
    } else {
      denom++;
    }
  }

  *GCD = tempGCD;
  *LCM = tempGCD*num1*num2;
}

int main() {
  unsigned int in1, in2;
  unsigned int GCD, LCM;

  while(cin >> in1 >> in2) {
    calcGCDLCM(in1,in2,&GCD,&LCM);
    cout << GCD << " " << LCM << endl;
  }
  return 0;
}

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

int main() {
  int p, q;
  int a, b, c;
  int lcm, gcd;

  while (1) {
    cin >> p >> q;
    if (cin.eof()) break;
    if (p > q) {
      a = p;
      b = q;
    } else {
      b = p;
      a = q;
    }

    while(a%b) {
      c = a-b;
      a = b;
      b = c;
    }
    lcm = b;
    gcd = p/lcm*q;
    cout << lcm << " " << gcd << endl;
  }
  return 0;
}

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

using namespace std;
#define lli unsigned long long int

lli gcd(lli a,lli b){
  lli c;
  while(a!=0){
    c=a; a=b%a; b=c;
  }
  return b;
}


int main(){
  lli a,b;
  while(~scanf("%lld%lld",&a,&b)){
          
    lli tmp1=gcd(a,b);
    lli tmp2=a*b/tmp1;
    printf("%lld %lld\n",tmp1,tmp2);

  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
    int n, m, a, b, i, j, g;
    
    while(cin >> n >> m){
        a=n;b=m;i=2;j=2;
        while(a!=b){
            if(a<b) a=n*i++;
            else b=m*j++;
        }
        g = n*((double)m/a);
        cout << g << " " << a << endl;
    }
}

C++: #include <iostream>
using namespace std;
int main() {
  int a, b, m, tmp_a, tmp_b;
  while (cin >> a >> b) {
    tmp_a = a;
    tmp_b = b;
    while (tmp_a != 0 && tmp_b != 0) {
      if (tmp_a > tmp_b) {
        tmp_a = tmp_a % tmp_b;
      } else {
        tmp_b = tmp_b % tmp_a;
      }
    }
    m = max(tmp_a, tmp_b);
    if (m == 0) {
      printf("%d %d", 0, 0);
    } else {
      printf("%d %d", a * b / m, m);
    }
  }
  return 0;
}

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

long long int GCD_Num(long long int a, long long int b)      //最大公约数
{
    long long int MAX=max(a,b);
    long long int MIN=min(a,b);
    long long int op;
    while(MAX%MIN!=0){
        op=MAX%MIN;
        MAX=MIN;
        MIN=op;
    }
    //cout<<MIN;
    return MIN;
}

void LCM_Num(long long int a, long long int b)
{
    long long int temp_lcm;
    temp_lcm=(a*b)/GCD_Num(a,b);
    cout<<GCD_Num(a,b)<<" "<<temp_lcm<<endl;
}

int main()
{
    long long int a,b;
    while(cin>>a>>b){
        GCD_Num(a,b);
        LCM_Num(a,b);
    }
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <iterator>
#include <limits>
#include <bitset>
#include <set>
#include <map>
#include <vector>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#define endl '\n'
#define INF (214748347/2)
#define LL long long
#define PII pair<int, int>
using namespace std;
const int MAXN = 40;

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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    int a, b;
    while (cin >> a >> b) {
        int g = gcd(a, b);
        cout << g << " " << a / g * b << "\n";
    }
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

constexpr int gcd(int a, int b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}

// deps: gcd
constexpr int lcm(const int &a, const int &b) {
  return a * b / gcd(a, b);
}

void solve() {
  int a, b;
  while (cin >> a >> b) cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
}

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

long long int gcd(long long int m,long long int n)
{
	if (n == 0)
		return m;
	return gcd(n,m % n);
}

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

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define int long long

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

signed main(){
        int a, b;
        while( scanf("%lld %lld", &a, &b) != EOF ){
                int c = gcd(a,b);
                printf("%lld %lld\n", c, (a/c)*(b/c)*c);
        }

        return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <fstream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 0x3f3f3f3f
#define inff -30000000
using namespace std;
typedef long long ll;
const int MAXN=1e5+10;
const int MAX=2000+10;
ll gcd(ll a,ll b){
    return (!b)?a:gcd(b,a%b);
}
int main(){
    #ifdef SIYU
    freopen("in.txt","r",stdin);
    #endif // SIYU
    ll a,b;
    while(cin>>a>>b){
        ll ans=gcd(a,b);
        cout<<ans<<" "<<a/ans*b<<endl;
    }
    return 0;
}

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

int main(){
	int a, b, c, G, R, L, tmp, r;
	while(cin >> a >> b){
		R = a; L = b;
		if(b > a){
			tmp = a;
			a = b; 
			b = tmp;
		}
		while(1){
			r = a % b;
			if(r == 0) break;
			a = b;
			b = r;
		}

		G = b;
		R = R / G;
		L = L / G;

		cout << G << " "  << R*L*G << endl;
	}
}

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

typedef long long lli;

lli gcd(lli a, lli b) {
  return b == 0 ? a : gcd(b, a%b);
}

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

int main() {
  lli a, b;

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

  return 0;
}