Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"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(){
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, 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
}

func gcd(x, y int) int{
	if x<y{
		gcd(y, x)
	}
	for 0<y{
		r := x%y
		x, y = y, r
	}
	return x
}

func lcm(x, y int)int{
	return (x*y)/gcd(x, y)
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

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

int main() {

  for (Integer a, b; cin >> a >> b, cin; ) {
    Integer x = max(a,b);
    Integer y = min(a,b);
    while (y > 0) {
      x %= y;
      Integer t = x;
      x = y;
      y = t;
    }
    //cerr << cons(a,b) << ' ' << cons(x, y) << endl;
    cout << x << ' ' << (a / x * b) << endl;
  }

  return 0;
}

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

int main(){
  bool is_prime[1000000];

  is_prime[0]=is_prime[1]=false;
  for(int i=2; i<1000000; i++){
    is_prime[i]=true;
  }

  for(int i=2; i*i<1000000; i++){
    if(is_prime[i]){
      for(int j=i*i; j<1000000; j+=i){
        is_prime[j]=false;
      }
    }
  }

  int n_prime[1000000];
  int cnt=0;

  for(int i=0; i<1000000; i++){
    if(is_prime[i]){
      cnt++;
    }
    n_prime[i]=cnt;
  }

  while(true){
    int n;
    cin >> n;

    if(cin.eof())
      break;

    cout << n_prime[n] << endl;
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

typedef unsigned long long ull;

int main()
{
	ull a, b, t;
	while(!cin.eof())
	{
		cin >> a >> b;
		ull M = max(a, b);
		ull m = min(a, b);
		while(m != 0)
		{
			t = M % m;
			M = m;
			m = t;
		}

		printf("%llu %llu\n", M, a * b / M);
	}
}

C++: #include<stdio.h>
main(a,b){while(scanf("%d%d",&a,&b))printf("%d %d\n",__gcd(a,b),__gcd(a,b)*b);
}

C++: #include <iostream>
int gcd(int a, int b)
{
  while (1) {
    if (b == 0) {
      return a;
    }
    int temp = b;
    b = a % b;
    a = temp;
  }
}

int lcd(int a, int b)
{
  return a / gcd(a, b) * b;
}

int main()
{
  int a, b;
  while (std::cin >> a >> b) {
    std::cout << gcd(a, b) << " " << lcd(a, b) << std::endl;
  }
  return 0;
}

C++: #include<stdio.h>



//公約数
long long int kouyakusuu_f(const long long int *a,const long long int *b)
{
	long long int hozon1 = *a,hozon2 = *b;
	//怖いからここでiを宣言
	long long int i = 0;

	//お互いを割って０なら小さいほうを返す(6と１２　高速道路)
	if (hozon1 % hozon2 == 0)
	{
		return hozon2;
	}
	if (hozon2 % hozon1 == 0)
	{
		return hozon1;
	}
	//それでも駄目なら小さいほうを２で割る
	if (hozon1 < hozon2)
	{
		i = hozon1 / 2;
	}
	else
	{
		i = hozon2 / 2;
	}


	while (1)
	{
		if (hozon1 % i == 0 && hozon2 % i == 0)
		{
			return i;
		}
		//２個ずつ減らす
		i -= 2;
	}

}





//公倍数
long long int koubaisuu(const long long int *a,const long long int *b)
{
	long long int hozon1 = *a,hozon2 = *b;
	long long int cnt1 = 1,cnt2 = 1;

	//保存１を保存２で割ると０のとき
	if (hozon1 % hozon2 == 0)
	{
		return hozon1;
	}
	//保存２を保存１で割ると０のとき
	if (hozon2 % hozon1 == 0)
	{
		return hozon2;
	}
	
	//合うまで回す
	while (1)
	{
		if (hozon1 == hozon2)
		{
			return hozon1;
		}
		while (hozon1 < hozon2)
		{
			cnt1++;
			hozon1 = *a * cnt1;
		}
		while (hozon1 > hozon2)
		{
			cnt2++;
			hozon2 = *b * cnt2;
		}
	}

	return hozon1;
}




int main(void)
{
	//入力変数
	long long int a = 0,b = 0;
	//出力変数
	long long int ans1 = 0, ans2 = 0;

	//回す
	while (scanf("%lld %lld",&a,&b) != EOF)
	{
		//計算してもらう(公約数)
		ans1 = kouyakusuu_f(&a,&b);
		//次は公倍数
		ans2 = koubaisuu(&a,&b);
	
		//表示
		printf("%lld %lld\n",ans1,ans2);
	}


	return 0;
}

C++: #include<stdio.h>
long long  GCD(long long m,long long n)
{
    long long t,r;
    if(n>m)
   {
   	t=m;
   	m=n;
	n=t;
	}
	while(n!=0)
	{
		r=m%n;
		m=n;
		n=r;
	}
	return m;
}
long long LCM(long long m,long long n)
{
    long long num;
    num=(n*m)/GCD(m,n);
    return num;
}
int main()
{
    long long n,m;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        printf("%d %d\n",GCD(m,n),LCM(m,n));
    }
    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 <bits/stdc++.h>
using namespace std;

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

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


int main()
{
	int a, b;
	while(cin>>a>>b)
	{
		int i = a;
		while (a%i != 0 || b % i != 0)
			i--;
		int j = a;
		while (j%a != 0 || j % b != 0)
			j++;
		cout << i << " " << j << endl;
	}
    return 0;
}

C++: #include <stdio.h>

int main(){

    int buf1[50],buf[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( b 1< b2 ){
            m = b2,n = b1;
        } else if( b1 > b2 ){
            m =  b1,n = b2;
        } else printf( "%d ",b2 );

        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ){
                printf( "%d\n",m );
                break;
        }
        while( b1 != b2 ){
            if( b1 < b2 ) b1 += buf1[i];
            else             b2 += buf2[i];
        }
        printf( "%d\n",b1 );
    }
    reutrn 0;
}

C++: #include <stdio.h>

int main(){
int a,b;
int x,y,i,j;

while(scanf("%d %d",&a,&b) != EOF){
if(a>=b){
for(i=1;i<=b;i++){
if(a%i==0 && b%i==0){
x=i;
}
}
}
else if(b>a){
for(i=1;i<=a;i++){
if(a%i==0 && b%i==0){
x=i;
}
}
}
if(a>=b){
for(i=1;i<11;i++){
for(j=1;j<11;j++){
if(a*i==b*j){
y=a*i;
break;
}
}
if(a*i==b*j)break;
}
}
else if(b>a){
for(i=1;i<11;i++){
for(j=1;j<11;j++){
if(b*i==a*j){
y=a*i;
break;
}
}
if(a*i==b*j)break;
}
}
printf("%d %d\n",x,y);
}
return 0;
}

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

long gcd(long a, long b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
int main(void){
    int a, b;
    while(cin >> a >> b){
        long s = gcd(a, b);
        cout << s << " " << a*b/s << endl;
    }
    return 0;
}

C++: #include<cstdio>
#include<algorithm>
int main(){int a,b;while(scanf("%d%d",&a,&b))printf("%d %d\n",std::__gcd(a,b),std::__gcd(a,b)*b);return 0;}

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

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

  return gcd(b,a%b);
}

int main(){
  while(true){
    int a,b;

    cin>>a>>b;

    if(cin.eof())
    break;

    int g=gcd(a,b);
    cout<<g<<' '<<a/g*b<<endl;
  }

  return 0;
}

C++: #include <cstdio>
using namespace std;
int a, b, d, e;
int gcd(int x, int y)
{
	if (x<y)
	{
		x+=y;
		y=x-y;
		x-=y;
	}
	if (y==0)
	return x;
	else
	return gcd(y, x%y)
}
int lcm(int x, int y)
{
	return (long long)x*y/d;
}
int main()
{ 
	while (scanf("%d%d", &a, &b)!=EOF)
	{
		d = gcd(a,b);
		e = lcm(a, b);
		printf("%lld %lld\n", d, e);
	}
}