Go: package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		x, y := nextInts()
		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.Fprintf(out, "%d %d\n", y, lcm/y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

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

int main()
{
	long int a, b;
	while (cin >> a >> b)
	{
		if (a < b) swap(a, b);
		//?????§??¬?´???°
		for (int i = 1; i <= a; i++)
		{
			if (a % i == 0 && b % (a / i) == 0)
			{
				cout << a / i << " ";
				break;
			}
		}
		//????°???¬?????°
		for (int i = 1; i <= b; i++)
		{
			if ((a * i) % b == 0)
			{
				cout << a * i << endl;
				break;
			}
		}
	}

	return 0;
}

C++: // B.cpp

#include <iostream>
#include <cmath>

using namespace std;

int gcd(int, int);
signed long int lcm(signed long int, signed long int);

int main(void) {
	long int a, b;
	cin >> a >> b; 
	cout << gcd(a, b) << " " <<  lcm(a, b) << endl;

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a < b){
		max = b, min = a;
	}
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
signed long int lcm(signed long int a, signed long int b) {
	signed long int max, min, res;
	res = 1;
	if(a > b){
		max = a, min = b;
	}
	if(a < b){
		max = b, min = a;
	}
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return a * b / max;
}

C++: #include <iostream>

#include <algorithm>


using namespace std;
int main()
{

double x,y,n,a,b;

while(cin>>x>>y)
{
a=x;
b=y;
while(x%y!=0)
{
n=x%y;
x=y;
y=n;
}
cout<<y<<" "<<a*b/y<<endl;
}
return 0;
}

C++: #include <iostream>

#define MAX(x,y) ((x>y)?x:y)
#define MIN(x,y) ((x>y)?y:x)
int main(void)
{
	while(true)
	{
		int x=0,y=0,product;
		std::cin >> x >> y;
		if(std::cin.eof())
			break;
		product = x*y;
		//ユークリッドの何とか
		while(x && y){
			if(x>y)
				x = x % y;
			else
				y = y % x;
		}
		std::cout << (int)x << " " << (int)(product/x) << std::endl;//確かGCD*LCMと元の積は等しいはず。
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
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\n", 0, 0);
    } else {
      printf("%d %d\n", a * b / m, m);
    }
  }
  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <sstream>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

const int MAX_N=50100;
int p[(MAX_N+1)/2];
bool isp[MAX_N+1];

int gen_ps(){
    memset(isp,1,sizeof(isp));
    isp[0]=isp[1]=false;
    int idx=0;
    loop(i,2,MAX_N+1){
        if(!isp[i]) continue;
        p[idx++]=i;
        for(int j=i+i; j<=MAX_N; j+=i){
            isp[j]=false;
        }
    }
    return idx;
}

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

C++: #include<iostream>
int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	for(int i=0;i<10;i++){
		int a,b;
		std::cin>>a>>b;
		std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl;
		
	}
	return 0;
}

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

typedef long long ll;

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

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

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

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

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

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = temp_b;
		cout << gcd << " ";

		lcm = a * b / gcd;
		cout << lcm << endl;

	}

	//getchar();

	return 0;
}

C++: #include<stdio.h>
long long int a, b;
long long int gcd()
{
	long long int min = a;
	if (b < a)min = b;
	int i;
	long long int max = 1;
	for (i = 2; i <= min; i++)
	{
		if (a%i == 0 && b%i == 0 && i > max)
			max = i;
	}
	return max;
}
int main()
{
	while (scanf("%lld %lld",&a,&b)==2)
	{
		long long int g = gcd();
		printf("%lld ", g);
		printf("%lld\n", (a / g)*(b / g)*g);
	}
}

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

using namespace std;

int main()
{
	unsigned int  a,b;

	while(cin >> a >> b){
		if(a<=0 || b<=0)
			continue;

		int temp = a<b?a:b;

		int t = temp;
		while((a<b?b:a)%t || (a<b?a:b)%t){
			if(!t)
				break;
			--t;
		}
		cout <<t<<" "<<flush;

		t = a>b?a:b;
		while(true){
			if(!(t%a))
				if(!(t%b))
					break;
			++t;
		}
		cout <<t<<endl;
	}

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <queue>
#include <cmath>

#define int64 long long int

using namespace std;

int GCD(int, int);
int LCM(int, int);

int main ()
{
    int a, b;
    while(cin >> a >> b){
        cout << GCD(a, b) << ' ' << LCM(a, b) << endl;
    }
    return 0;
}

int GCD(int a, int b){
    int buf;
    while(a % b != 0){
        buf = a % b;
        a = b;
        b = buf;
    }
    return b;
}

int LCM(int a, int b){
    int64 ab = (int64)a*b;
    return ab / GCD(a, b);
}

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

int gcd( int m, int n ){
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;

	while( m != n ){
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}
int lcm( int m, int n ){
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	return ((m / gcd(m, n)) * n); 
}
int main(){
	int m, n;
	cin >> m;
	cin >> n;
	cout << gcd(m,n) << " " << lcm(m,n) << endl;
	return 1;
}

C++: /*************************************************************************
    > File Name: aoj0005.cpp
    > Author:    WArobot 
    > Blog:      http://www.cnblogs.com/WArobot/ 
    > Created Time: 2017??´06???19??\ ????????? 16??¶44???39?§?
 ************************************************************************/

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

#define ll long long
ll gcd(ll a,ll b){
	return b == 0 ? a : gcd(b,a%b);
}
int main(){
	ll a , b;
	while(~scanf("%lld%lld",&a,&b)){
		ll ret = gcd(a,b);
		printf("%lld %lld\n",ret,a*b/ret);
	}
	return 0;
}

C++: #include <algorithm>
#include <iostream>
int main() {
	long long a, b;
	while (std::cin >> a >> b) {
		std::cout << __gcd(a,b) << " " << a / __gcd(a,b) * b << "\n";
	}
}