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<iostream>

int main(){
	int a[44722],b,c,d,e=0,f=1;
	while(std::cin >> b >> c){
	for(d=2;d*d<=b||d*d<=c;){
		if(b%d==0&&c%d==0){
			a[e] = d;
			e++;
			b = b / d;
			c = c / d;
		}else break;
	}
	for(d=3;d*d<=b||d*d<=c;d=d+2){
		while(1){
			if(b%d==0&&c%d==0){
			a[e] = d;
			e++;
			b = b / d;
			c = c / d;
			}else break;
		}
	}
	a[e] = 0;
	for(e=0;a[e]>0;e++){
		f = f * a[e];
	}
	std::cout << f;
	f = f * b * c;
	std::cout << " " << f << std::endl;
	e = 0;
	f = 1;
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		int x=a,y=b;
		while(true){
			if(x==y)
				break;
			if(x>y)
				x-=y;
			else if(y>x)
				y-=x;
		}
		cout<<x<<" ";
		int keep=x;
		x=a/keep;
		y=b/keep;
		cout<<x*y*keep<<endl;
	}
	return 0;
}

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

unsigned GCD(unsigned a, unsigned b)
{
	unsigned s=(a<b)?a:b, l=(a<b)?b:a;
	unsigned gcd=1;
	for(unsigned i=2; i<=s; ++i)
	{
		while(s%i==0 && l%i==0)
		{
			s/=i;
			l/=i;
			gcd*=i;
		}
	}
	return gcd;
}

unsigned LCM(unsigned a, unsigned b)
{
	unsigned large = (a<b)?b:a;
	unsigned x = large;
	for(unsigned i=1; x<2000000000; ++i)
	{
		if(x%a==0 && x%b==0)
		{
			return x;
		}
		x+=large;
	}
}

int main()
{
	double a,b;
	while(cin>>a>>b)
	{
		cout << GCD(a,b) << ' ' << LCM(a,b) << '\n';
	}
}

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

//max 
long int gcd(long int a, long int b){
    if((a==0 || b==0)) return 0;
    while(a!=b){
        if(a>b) a=a-b;
        else b=b-a;
    }
    return a;
}

//min
long int lcm(long int a, long int b){
    if((a==0||b==0)) return 0;
    return ((a / gcd(a, b)) * b);
}
int main(void){
    long int 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,gcd,lcm;
	while (cin >> a >> b)
	{
		for (int i = a; i > 0; i--)
		{
			if (b%i == 0&&a%i==0)
			{
				gcd = i;
				break;
			}
		}
		for (int j = a;; j++)
		{
			if (j%a == 0 && j%b == 0)
			{
				lcm = j;
				break;
			}
		}
		cout << gcd << " " << lcm << endl;
	}
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b,s,m,ta,tb,tmp;
	while(cin>>a>>b){
	ta=a,tb=b;
	s=0,m=0;
	if(a<b)swap(a,b);
	if(a==0||b==0){
	
	}
	else 
	while(true){
		tmp=a;
		a=b;
		b=tmp%a;
		if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
	}
		
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
}

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

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

int lcm(int n, int m) {
    if (n < m) swap(n, m);
    if (m == 0)
        return n;
    else
        return lcm(m, n % m);
}

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

C++: #include<iostream>

using namespace std;

int main(){
	int a,b,ta,tb,tc;
	while(cin >> a>>b){
		ta=a;
		tb=b;
		while(1){
			if(ta<tb){
				tc=ta;
				ta=tb;
				tb=tc;
			}
			tc=ta%tb;
			if(tc==0)break;
			ta=tb;
			tb=tc;
		}
		cout << tb<< " "<< a*b/tb <<endl;
	}
	return 0;
}

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

inline u_long lcm(const u_long a, const u_long b) {
    return a * b / std::__gcd(a, b);
}

int main(void) {
    u_long a, b;

    while (std::cin >> a >> b) {
        std::cout << std::__gcd(a, b) << " " << lcm(a,b) << std::endl;
    }

    return 0;
}