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;
typedef unsigned long long ll;
ll gcd(ll a,ll b)
{

   return b==0?a:gcd(b,a%b);
}
int main()
{
    ll a,b;
    while(cin>>a>>b)
    {
        ll t = gcd(a,b);
        cout << t << " " << a*b/t << endl;
    }

}

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

using namespace std;

typedef long long ll;

ll gcd(const ll sx, const ll sy) {
    ll x = min(sx, sy);
    ll y = max(sx, sy);
    ll tmp;
    while (x > 0) {
        tmp = y;
        y = x;
        x = tmp % x;
    }
    return y;
}

ll lcm(const ll x, const ll y) {
    return x / gcd(x, y) * y;
}

// ref. http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005
int main(void) {
    char buf[1024];
    int res;
    while (1) {
        if (fgets(buf, 1024, stdin) == NULL) {
            if (feof(stdin)) {
                return 0;
            } else {
                perror("fgets");
                return 1;
            }
        }

        ll x, y;
        sscanf(buf, "%lld %lld", &x, &y);
        cout << gcd(x, y) << " " << lcm(x, y) << endl;
    }
}

C++: // B.cpp

#include <iostream>

using namespace std;

int gcd(int, int);
int lcm(int, int);

int main(void) {
	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;
	}
	if(min == 0) return max;
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define N 2000000000
int main() {
	long long int a,b;
	while(cin>>a>>b){
		int* ahoge;
		int* bhoge;
		ahoge=(int*)malloc(sizeof(int)*N);
		bhoge=(int*)malloc(sizeof(int)*N);
		long long int i,j;
		for(i=2;i<=a;i++){
			if(a%i==0){
				int count=0;
				do{
					a=a/i;
					count++;
				}while(a%i==0);
				ahoge[i]=count;
			}	
		}
		for(j=2;j<=b;j++){
			if(b%j==0){
				int count=0;
				do{
					b=b/j;
					count++;
				}while(b%j==0);
				bhoge[j]=count;
			}	
		}
		long long int great,least,k;
		great=1;
		least=1;
		for(k=2;k<min(i,j);k++){
			great=great*pow(k,min(ahoge[k],bhoge[k]));
		}
		for(k=2;k<max(i,j);k++){
			least=least*pow(k,max(ahoge[k],bhoge[k]));
		}
		cout<<great<<" "<<least<<endl;
	}
	return 0;
}

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

bool 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, lcm;

  while(scanf("%d %d", &a, &b))
  {      
    lcm = b/gcd(a,b)*a;
    printf("%d %d\n", gcd(a,b), lcm);
  }

  return 0;
}

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

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

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

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

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

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

using namespace std;

int main()
{
	unsigned long a, b, r, c, d;
	unsigned long ta, tb;

	scanf("%d%d", &a,& b);
	if (a > b){
		ta = a;
		tb = b;
	} else {
		ta = b;
		tb = a;
	}
	

	while (1) {
	r = ta % tb;
	if (r == 0) break;
	ta = tb;
	tb = r;
	}
	c = tb;

	
	d = a * (b  / c);
	

	printf("%d %d\n", c, d);

	return (0);
}

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

using namespace std;

int GCD(const int& a, const int& b) {
	if (b == 0) {
		return a;
	}
	return GCD(b, a%b);
}

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

C++: #include <iostream>
#include<string>
using namespace std;
void hideki(int x,int y){
    
}

int main(){
    int a,b;
    cin>>a>>b;
    int d=a*b;
    if(a>b)
    while(a%b!=0&&a>b){a=a%b;}
    else
    while(b%a!=0&&b>a){b=b%a;}
    int c=min(a,b);
    cout<<c<<" "<<d/c<<endl;
    
    return 0;
}

C++: #include<stdio.h>
int gcd(int x,int y){
    int r,m;
    if(x < y){
        m=x;
        x=y;
        y=m;
    }
    while(y > 0){
        r = x % y;
        x = y;
        y = r;
    }
    return x;
}
int main()
{
    unsigned long long int a,b,x,n;
    while(scanf("%lld%lld",&a,&b)!=EOF){
        x=gcd(a,b);
        printf("%lld ",x);
        n=a/x*b;
        printf("%lld\n",n);
    }
    return 0;
}

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

using namespace std;

int main() {

long long int a, b, r, haco1, haco2, maxky, minkb;

while (1) {

	cin >> a >> b;
	haco1 = a;
	haco2 = b;
	
	if ( cin.eof() ){
		break;
	}	

	//loop of maxky
		while(1){
				if(b == 0) {
					maxky = a;
					break;
				}
			r = a % b;
				if(r == 0){
					maxky = b;
					break;
				}
			a = b % r;
				if(a == 0){
					maxky = r;
					break;
				}			
			b = r % a;
		}
		
		//minkb
		
		minkb = (haco1 * haco2) / maxky;

	cout << maxky << " " << minkb << endl; 		
}


    return 0;
}

C++: #include <iostream>

using namespace std;
long long int firstNumber,secondNumber;

long long int GCD(int x, int y)
{
    while(x!=y)
    {
        if(x<y)
        {
            y = y-x;
        }
        if(y<x)
        {
            x = x-y;
        }
    }
    return x;
}

long long int LCM(int x, int y)
{
    return (x / GCD(x,y))*y;
}



int main()
{   while(cin >> firstNumber >> secondNumber)
    {
        cout << GCD(firstNumber,secondNumber) << " " << LCM(firstNumber,secondNumber) << endl;
    }

}

C++: #include <cstdio>
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)
    {
        int g = gcd(a,b);
        int l = a/g*b;
        printf("%d %d\n",g,l);
    }
}

C++: #include<iostream>
#include<stdio.h>
int yue(int a,int b){
	int min;
	int max;
	if(a==0||b==0){
		return 0;
	}else{
		if(a<b){
			min=a;max=b;
		}else{
			min=b;max=a;
		}
		int shang=max-min;
		while(shang!=min){
			if(shang<min){
				max=min;
				min=shang;
			}else{
				max=shang;
				min=min;
			}
			shang=max-min;
		}
		return shang;
	}
}
int bei(int a,int b){
	int min;
	int max;
	if(a==0||b==0){
		return 0;
	}else{
		if(a<b){
			min=a;max=b;
		}else{
			min=b;max=a;
		}
		int yu=max%min;
		int beishu=1;
		int mmax=max;
		while(yu!=0){
			beishu++;
			max=mmax*beishu;
			yu=max%min;
		}
		return max;
	}
}
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b)!=EOF){
		printf("%d %d\n",yue(a,b),bei(a,b));
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    long long a,b,i,f,j;
    while(cin>>a>>b){
    for(j=0;j<50;j++){
    for(i=20000000;i>0;i--){
        if(a>=2000000000||b>=2000000000||a<1||b<1){
            break;
        }
        if(a%i==0&&b%i==0){
            f=a*b/i;
            cout<<i<<" "<<f<<endl;
                break;
        }
    }
    }
    }
    return 0;
}