Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll N, K;
VL neg, pos;
VL nmax, pmax;

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

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

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b,s,m,ta,tb,tmp;
	while(cin>>a>>b){
	ta=a,tb=b;
	s=1,m=1;
	if(a<b)swap(a,b);
	else 
	while(true){
		tmp=a;
		a=b;
		b=tmp%a;
		if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
	}
}

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

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

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

int gcd(int x,int y){
  if(x%y==0) return y;
  else{
    int z=x%y;
    return gcd(y,z);
  }
}

int main()
{
  int a,b;
  int g;
  long int l;
  while(cin >> a >> b){
  
    if(a>b) g=gcd(a,b);
    else if(a<b) g=gcd(b,a);
    else g=a;

    l=(long int)a*b/g;
    cout << g << " " << l << endl;
  }

  return 0;
}

C++: #include <cstdio>

int main(){
    long long int m, n, gcd, lcm, temp;
    while(scanf("%lld %lld", &m, &n) == 2){
        lcm = n * m;
        if( m < n ){
            temp = m;
            m = n;
            n = temp;
        }
       for(;;){
           if(n == 0) break;
           temp = n;
           n = m % n;
           m = temp;
       }
       gcd = m;
       lcm = lcm / gcd;
       printf("%lld %lld\n", gcd, lcm);
    }
    return 0;
}

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

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005

long int gcd(int a, int b) {
	if (a < 0) a *= -1;
	if (b < 0) b *= -1;
	if (a < b) {
		int t = a;
		a = b; 
		b = t;
	}
	if (b == 0) return a;
	return gcd(b, a % b);
}

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

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

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

template<typename T>
T gcd(T p, T q)
{
	while(q != 0)
	{
		T temp = p % q;
		p = q;
		q = temp;
	}

	return p;
}

template<typename T>
T lcm(T p, T q)
{
	return p / gcd(p, q) * q;
}

int main()
{
	unsigned 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 num[2];
inline int gcd(int a, int b)
{
	return num[0] = b == 0 ? a : gcd(b, a%b);
}
inline int* lcm(int a, int b)
{
	num[1] = a/gcd(a, b)*b;
	return num;
}
int main()
{
	int a, b;
	while(scanf("%d%d", &a, &b) != EOF)
	{
		if(a < b) swap(a, b);
		lcm(a, b);
		printf("%d %d\n", num[0], num[1]);
	}
	return 0;
}

C++: /*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005
 */
#include <iostream>
#include <sstream>

#define N 2

using namespace	std;

long
gcd(long a, long b)
{
	return a % b == 0 ? b : gcd(b, a % b);
}
long
lcm(long a, long b)
{
	long t = gcd(a, b);
	return t ? (a * b) / t : 0;
}
int
main()
{
	string line;
	while (getline(cin, line)) {
		istringstream iss(line);
		long a, b;
		iss >> a >> b;
		cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
int main(){

long long int a,b,A,B;

while(cin>>a>>b){
 A=a;B=b;
 while (b)
      {
	int tmp = a % b;
	a = b;
	b = tmp;
      }

b=A*B/a;
cout<<a<<" "<<b<<endl;
}
return 0;
}

C++: #include <iostream>

using namespace std;
int f(int a,int b){
     int n;
     n=a%b;
   return n;
}
int main(){
    int a,b,c,d,x,y,z;
    while(cin>>x>>y){
    a=x;
    b=y;
    c=1;
      for(d=0;c>0;d++){
         c=f(a,b);
         a=b;
         b=c;
    }
    z=x*y/a;
    cout<<a<<" "<<z<<endl;
         }
         return 0;
}

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

C++: 

#include <stdio.h>
  
int main(){
   
    int buf1[50],buf2[50];
   
    int k = 0;
    while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++;
   
    for( int i = 0;i < k;i++ ){
        int b1 = buf1[i],b2 = buf2[i];
        int m,n;
        if( b1< b2 ){
            m = b2,n = b1;
        } else if( b1 > b2 ){
            m =  b1,n = b2;
        } else {
            n = 0;
            m = b1;
        }
        
        while( n != 0 ){
            int buf = n;
            n = m % n;
            m = buf;
        }
        printf( "%d\n",m );

        while( b1 != b2 ){
            if( b1 < b2 ) b1 += buf1[i];
            else             b2 += buf2[i];
        }
        printf( "%d\n",b1 );
    }
    return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<cstring>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    ll a,b;
    while(cin>>a){
        cin>>b;
        if(b>a)swap(b,a);
        ll aa=a,bb=b;
        ll o,p,q;
        while(bb!=0){
            o=bb;
            p=aa%bb;
            aa=bb;bb=p;
        }
        ll i=1;
        while(true){
            i++;
            ll ao=a*i;
            if(ao%b==0){
                q=ao;
                break;
            }
        }
        cout<<o<<" "<<q<<endl;
    }
    
    
    
    
    return 0;
}