Go: package main

import (
	"fmt"
	"bufio"
	"os"
	"strings"
	"strconv"
)

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

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

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );

	LL a, b;
	
	while ( cin >> a >> b )
	{
		LL res1 = gcd( a, b );
		LL res2 = a * b / res1;

		cout << res1 << ' ' << res2 << endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

typedef long int lint;
typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl "\n"
#define mod 1000000007
#define INF 100000000

const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

template<typename T>
void print(const std::vector<T>& v, char sep=' ') {
  for (int i = 0; i < (int)v.size(); i++) {
    if (i != 0) cout << sep;
    cout << v[i];
  }
  cout << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x, y;
  while (cin >> x >> y){
    int res = __gcd(x, y);
    cout << res << ' ' << max(x, y) / res * min(x, y) << endl;
  }
}

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

int gcd(int a, int b){
  //a < b ユークリッドの互除法
  if(a==0) return b;
  return gcd(b%a,a);
}

//lcm = a*b/gcd
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>
#include<cstdio>
using namespace std;
int gcd(int u, int v)
{
  int r, z;
  if(v > u)
  {
    z = u;
    u = v;
    v = z;
  }
  while((r = u%v) != 0)
  {
    u = v;
    v = r;
  }    
  return v;  
}

int main(void)
{
  int a, b;
  while(scanf("%d %d", &a, &b) != EOF)
  {      
    printf("%d %d\n", gcd(a,b), b/gcd(a,b)*a);
  }
  return 0;
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

long long gcd(long long b, long long c) {
	long long r = b % c;
	while (r!=0)
	{
		b = c;
		c = r;
		r = b%c;
	}
	return c;
}

int main() {
	long long a[2];
	long long tmp;
	long long GCD = 1;
	long long LCM = 1;
	while (cin >> a[0] >> a[1])
	{
		// ????????????????????????
		if (a[0] < a[1]) {
			tmp = a[0];
			a[0] = a[1];
			a[1] = tmp;
		}
		else {}
		// ?????§??¬?´???°????¨????
		GCD = gcd(a[0], a[1]);

		// ????°???¬?????°????¨????
		LCM = a[0] * a[1] / GCD;

		// ??????
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <math.h>

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcd = l(a, b);
    std::cout << a << " " << b << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a %= b;
    }else{
      b %= a;
    }
  }
  
  if(a==1) return b;
  else     return a;
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0) return i;
      else i++;
    }else{
      i++;
    }
  }
}

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<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;
}

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

void swap(int& a, int& b) {
	int tmp = a;
	a = b;
	b = tmp;
}

void calcGCD(int& gcd, const int a_, const int b_) {
	int a = a_;
	int b = b_;
	int r = a % b;
	if(r == 0) {
		gcd = b;
	} else {
		a = r;
		if(a < b) {
			// swap to set a >= b
			swap(a, b);
		}
		calcGCD(gcd, a, b);
	}
}

void calcLCM(int& lcm, const int gcd, const int a, const int b) {
	lcm = (int)((double)a * b / gcd);
}

int main(){
	int a, b;
	while(cin >> a >> b) {
		if(a < b) {
			swap(a, b);
		}
		int gcd;
		int lcm;
		calcGCD(gcd, a, b);
		calcLCM(lcm, gcd, a, b);
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

int gcd(int a,int b){
	while(a != b){
		if(a > b) a -= b;
		else b -= a;
	}
	return a;
}
int lcm (int a,int b){
	return ((a / gcd(a,b)) * b);
}
int main(){
	int x,y;
	while(cin >> x >> y){
		cout << gcd(x,y) << " " << lcm(x,y) << endl;
	}
	return 0;
}

C++: //44
#include<iostream>
#include<algorithm>

using namespace std;

int gcd(int h,int l){
  if(h<l){
    swap(h,l);
  }
  while(h%l){
    h%=l;
    swap(h,l);
  }
  return l;
}

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