Go: package main

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

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

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


#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repback(i,n) for(int i=(int)n-1;i>=0;i--)
#define repa(i,a,n) for(int i=a;i<(int)(n);i++)
typedef pair<int, int> P;
typedef long long ll;
const ll INF = 1e7, MAX_N = 1000000, MAX_M = 1000, MAX_W = 20, MAX_H = 20;
int asc(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

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

ll lcm(ll a, ll b) {
    return a * b / (ll)gcd(a, b);
}

int main() {
    int n,m;
    while (cin >> n >> m) {
        int a1 = gcd(n, m);
        int a2 = lcm(n, m);
        cout << a1 <<" "<< a2 << endl;
    }

    return 0;
}

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

int main()
{
    int a,b,GCD,LCM=0;
    
    while(cin >> a >> b){
    
    if (a<b) {
        for(int i=1;a>=i;i++){
            if (b % i == 0 && a % i == 0) {
                GCD=i;
            }
        }
    }else{
        for(int i=1;b>=i;i++){
            if (b % i == 0 && a % i == 0) {
                GCD=i;
            }
        }
    }
    
    LCM = a*b/GCD;
    
    cout << GCD << " " << LCM << endl;
    }
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	unsigned long long a,b,c,d,e,f,maxx=0,data,minn=0,o;
	while (scanf("%llu %llu",&a,&b)!=EOF){
		data=max(a,b);
		while(maxx==0){
			if (a%data==0 && b%data==0) maxx=data;
			data-=1;
		}
		minn=a*b/maxx;
		cout<<maxx<<" "<<minn<<endl;
		maxx=0;
		minn=0;
	}
	return 0;
}

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

long long gcd(long long a, long long b)
{
	long long tmp;
	while(b!=0)
	{
		tmp=b;
		b=a%b;
		a=tmp;
	}
	return a;
}

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

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include <sstream>
using namespace std;
int main(void){
    long a,b,tmp;
    while(cin >> a >> b){
        long ab = a * b;
        if(a<b){
            tmp = a;
            a = b;
            b = tmp;
        }
        long r = a % b;
        while(r!=0){
            a = b;
            b = r;
            r = a % b;
        }
        cout << b << " " << ab/b << endl;

    }
}

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

//最大公約数(greatest common divisor)と最小公倍数(least common multiple)を計算する関数
void lcm_gcd(long int a, long int b){
	long int i;
	long int x = 1;
	while(1){
		for(i=2;i < a;i++){
		if(a % i == 0 && b % i == 0){
		a /= i;
		b /= i;
		x *= i;
			}
		}
		if(i == a){
		cout << x  << " " << x * a * b << endl;
		break;
		}
		
		
	}
}
			
int main(){
	long int a, b;
	while(cin >> a >> b){
		lcm_gcd(a,b);
	}
	return 0;
}

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

using namespace std ;

long long a, b, Gcd;

void gcd(int a, int b) {
	if (a < b) swap(a,b);
	while (a % b != 0) {
		a %= b;
		swap(a, b);
	}
	Gcd = b;
}

long long lcm(long long a , long long b) {
	return a * b / Gcd;
}

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

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

int main(){
	long a, b, t, gcd, lcm;
	while( scanf("%d%d",&a,&b)!=EOF ){
		t=a*b;
		while(a!=b){
			while(a>b) a-=b;
			while(a<b) b-=a;
		}
		gcd=a;
		lcm=t/gcd;
		printf("%ld %ld\n",gcd, lcm);
	}
 return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()

long GCD(long a, long b) {
    if (b % a) return GCD(b % a, a);
    else return a;
}

long LCM(long a, long b) {
    return a / GCD(a, b) * b;
}

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

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

int main() {
	int a, b, A, B;
	int LCM = 0;	//最小公倍数
	int GCD = 0;	//最大公約数
	while (cin >> a >> b) {
		if (a < b) {
			int temp = a;
			a = b;
			b = temp;
		}
		A = a, B = b;
		while (a%b != 0) {
			int r = a % b;
			a = b;
			b = r;
		}
		GCD = b;
		LCM = A * (B / GCD);
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

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

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

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

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

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

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

using namespace std;

int a,b;

void search(int t)
{
	int r;
	
	if(r==0)
		return;
	
	if(t==1)
	{
		r=a%b;
		a=r;
		search(t=0);
	}
	else
	{
		r=b%a;
		b=r;
		search(t=1);
	}
	
}
int main()
{
	int a2,b2;
	
	for(;cin >> a;)
	{
		cin >> b;
		a2=a;
		b2=b;
		
		a=max(a2,b2);
		b=min(a2,b2);
		
		search(1);
		
		a=max(a,b);
		
		cout << a << " " << a2*(b2/a) << endl;
	}
}

C++: #include <iostream>
#include <stdlib.h>
using namespace std;
int GCD(int a,int b)
{
	if (a%b==0)
		return b;
	else
		return GCD(b,a%b);
}
int cmp(const void *a,const void *b)
{
	return *(int*)b-*(int*)a;
}
int main()
{
	int a[2],gcd,lcm;
	while(cin>>a[0]>>a[1])
	{
		if (cin.eof())break;
		qsort(a,2,sizeof(int),cmp);
		gcd=GCD(a[0],a[1]);
		lcm=(a[0]*a[1])/gcd;
		cout<<gcd<<' '<<lcm<<endl;
	}
	return 0;
}

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

//?????§??¬?´???°
int gcd(int m, int n){
	if ((m == 0) || (n == 0)) return 0;


	while ((m != 0) && (n != 0)){
		m > n ? m = m%n : n = n%m;
	}
	if (m == 0) return n;
	else return m;
}

//????°???¬?????°
int lcm(int m, int n){
	if ((m == 0) || (n == 0)) return 0;

	return m*n / gcd(m, n);
}



int main()
{
	long long int a, b, n, m;
	while (scanf("%lld %lld", &a, &b) != EOF)
	{
		n = gcd(a, b);
		m = a * (long long int)(b / n);
		cout << n << " " << m << endl;
	}

	return 0;
}

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

int saidai(int a,int b){
	

	while(a !=b){
		if(a>b){
			a -=b;
		}
		else{
			b -=a;
		}
	}
	
	return a;
}

int main(){
	int a,b,c,d;
	cout<<"atai1=";
	cin>>a;
	cout<<"atai2=";
	cin>>b;

	c=saidai(a,b);
	d=a*b/c;
	cout<<c<<" "<<d;
	return 0;
}

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

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

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

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