Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Printf("%d %d\n", y, lcm/y)
	}
}

C++: #include <assert.h>
#include <ctype.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

#include <algorithm>
#include <complex>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define SZ(a) (int)(a).size()
#define FOR(i,a,b) for (int i=(a); i<=(b); ++i)
#define REP(i,n) for (int i=0; i<(n); ++i)
#define ALL(c) c.begin(), c.end()
#define CLR(c,n) memset(c, n, sizeof(c))
#define TR(it, c) for(typeof(c.begin()) it = c.begin();it != c.end(); ++it)
#define CONTAIN(it, c) (c.find(it) != c.end())
typedef vector<int> VI;
typedef pair<int, int> PII;
template <class T> void checkmin(T &a, T b) { if (b<a) a=b; }
template <class T> void checkmax(T &a, T b) { if (b>a) a=b; }
const int INF=0x3F3F3F3F;

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

int main(int argc, char *argv[]) {
  int a, b;
  while (scanf("%d %d", &a, &b) == 2) {
    int g = gcd(a, b);
    printf("%d %d\n", g, a / g * b);
  }
}

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

int main(){ 
    unsigned long long int a,b,n,m;

    while(cin >> a >> b){
        if(a >= b){
            m = a;  
            n = b;  
        }       
        else{   
            n = a;  
            m = b;  
        }       

        while(n != 0){
            unsigned long int i = n;
            n = m % n;
            m = i;  
        }       
        n = a*b/m;

        cout << m << " " << n << endl;
    }
    return 0;

}

C++: #include <iostream>
#include <cmath>
using namespace std;
long gcd(long a, long b){
  if(b == 0){
    return a;
  }
  return gcd(b, a % b);
}
int main(){
  long a, b;
  while(cin >> a >> b){
    cout << gcd(a, b) << " ";
    cout << (a * b) / gcd(a, b) << endl;
  }
  return 0;
}

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

long long gcd(long long m, long long n);
long long lcm(long long m, long long n, long long g);

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    long long a, b;
    long long g, l;
    while (std::cin >> a >> b) {
        g = gcd(a, b);
        l = lcm(a, b, g);
        std::cout << g << " " << l << std::endl;
    }
}

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

long long lcm(long long m, long long n, long long g)
{
    return m * n / g;
}

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

typedef long long ll;

int EuclidAlgo(int a,int b);

int main()
{
        ll a,b,ans1,ans2;

        while(cin >> a >> b){

                if(a < b) swap(a,b);

                ans1 = EuclidAlgo(a,b);
                ans2 = (a*b)/ans1;

                cout << ans1 << ' ' << ans2 << "\n";



        }

        return 0;

}

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

C++: #include<iostream>
using namespace std;
int main(){
  int a,b,r,G,R,L,tmp;
  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 <stdio.h>

using namespace std;

int calcMax(int a,int b){
	int tmp;
	if(a > b){
		while(b != 0){
			tmp = b;
			b = a%b;
			a = tmp;
		}
		return a;
	}else{
		while(a != 0){
			tmp = a;
			a = b%a;
			b = tmp;
		}
		return b;
	}
}



int calcMin(int a,int b){
	int max_common = calcMax(a,b);
	return (a/max_common)*b;
}

int main(){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		printf("%d %d\n",calcMax(a,b),calcMin(a,b));
	}

    return 0;
}

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

int main(void){
    long long a,b,c,d,x,ans01,ans02;
    while(std::cin >> a >> b){
        if(b > a){
           x = a;
           a = b;
           b = x;
        }
        c = a % b;
        d = b % c;
        if(d == 0) {
            ans01 = c;
            ans02 = a * b / c;
        }
        else if (c % d == 0) {
            ans01 = d;
            ans02 = a * b / d;
        }
        std::cout << ans01 << " " << ans02 << std::endl;
    }
    return 0;
}

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

int gcd( int a, int b)
{
   return b ? gcd(b,a%b):a;
}


int main()
{
    int a,b;
   while(scanf( "%d%d",&a,&b) != EOF)
    {

        cout << gcd( a,b )<< " "<< a/gcd( a,b) * b << endl;

    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
long long int a,b,gcd,lcm,tmp,r,num_a,num_b;
while(cin>>num_a>>num_b){
a=num_a;
b=num_b;
if(a<b){
tmp = a;
a = b;
b = tmp;
}
r=a%b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
gcd = b;
lcm = (num_a*num_b)/gcd;
cout<<gcd<<" "<<lcm<<endl;
}
return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int a, b;
	while (cin >> a >> b) {
		int a2 = max(a, b), b2 = min(a, b);
		while (b2 > 0) {
			int r = a2 % b2;
			a2 = b2;
			b2 = r;
		}
		cout << a2 << ' ' << a / a2 * b << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

void solve(ll a,ll b){
    ll g = gcd(a,b);
    ll l = a/g*b;
    cout << g <<  " " << l << endl;
}

int main(){
    ll a,b;
    while(cin>>a>>b){
        solve(a,b);
    }
}

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