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() {
		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>
 
using namespace std;
 
int GCD(int a, int b)
{
    if(a % b == 0) { return b; }
 
    if(b % a == 0) { return a; }
 
    if(a > b) { return GCD(a % b, b); }
 
    if(a < b) { return GCD(a, b % a); }
}
 
 
int main()
{
    int a, b;
 
    while(cin >> a >> b)
    {
int n=GCD(a,b);
        cout << n << ' ' << a/n*b << endl;
    }
 
    return 0;
}

C++: #include<iostream>

//最大公約数を求めるプログラム(m >= n)
int calcGcd(int m, int n);
//最小公倍数を求めるプログラム
inline int calcLcm(int m, int n, int gcd);

int main(){
	int gcd, lcm, x, y;
	
	while(std::cin >> x >> y){
		if(x > y) gcd = calcGcd(x, y);
		else gcd = calcGcd(y, x);
		lcm = calcLcm(x, y, gcd);
		
		std::cout << gcd << " " << lcm << std::endl;
	}
}

int calcGcd(int m, int n){
	if(n == 0) return m;
	else return calcGcd(n, m%n);
}

inline int calcLcm(int m, int n, int gcd){
	return m / gcd * n;
}

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

int GCD(int m, int n){
  while(m!=n){
    if(m>n) m-=n;
    else n-=m;
  }
  return m;
}

int LCM(int m, int n){
  return m/GCD(m, n)*n;
}

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

C++: #include <stdio.h>

int main(){
long int a,b,aa,bb;
long int x,y;

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

C++: #include<stdio.h>
int gcd(int x, int y);
int lcm(int x, int y, int g);
int main(){
    int g,l,x,y;
    while (scanf("%d%d",&x,&y) != EOF){
        g=gcd(x,y);
        l=lcm(x,y,g);
        printf("%d %d\n",g,l);
    }
    return 0;
}
int gcd(int x, int y){
    int a,b,c,GCD;
    if(x > y){
        a=x;
        b=y;
        for(;;){
            c = a % b;
            if(a % b == 0){
                GCD=b;
                break;
            }
            a=b;
            b=c;
        }
    }
    else if(x < y){
        a=y;
        b=x;
        for(;;){
            c = a % b;
            if(a % b == 0){
                GCD=b;
                break;
            }
            a=b;
            b=c;
        }
    }
    else if(x == y) GCD=x;
        return GCD;
}
int lcm(int x, int y, int g){
    return (x/g)*(y/g)*g;
}

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

int solve(int a, int b){
    int r;
    r = a % b;

    if(r == 0){
        return b;
    }else{
        return solve(b, r);
    }
}

int main(){
    int a, b;
    int gcd, lcm;

    while(cin >> a >> b){
        gcd = solve(a, b);
        lcm = a / gcd * b;

        cout << gcd << " " << lcm << endl;
    }

    return 0;
}

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

int main() {
	long a,b,G;
	while (cin>>a>>b){
	long c = 1;
	for (c = 1;c <= b ;c= c+1){
		if(a%c == 0 , b%c == 0){
			G = c;
		}
	}cout<<G<<" "<<a*b/G<<endl;
	}
}

C++: #include <iostream>

using namespace std;

void gcd_lcm(int, int);

int main() {

	int a, b;

	while(cin >> a >> b) {
		gcd_lcm(a, b);
	}

}

void gcd_lcm(int a, int b) {
	int i=2, gcd=1;
	if(a<b) {
		int t=a;
		a=b;
		b=t;
	}

	while(i<=a) {
		if(a%i==0&&b%i==0) {
			gcd*=i;
			a/=i;
			b/=i;
			continue;
		}
		i++;
	}
	
	cout << gcd << " " << a*b*gcd << endl;
}

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

using namespace std;

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

}

C++: #include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
using namespace std;

long long gcd(long long a,long long b)
{
    if (b==0) return a;
    return gcd(b,a%b);
}
long long lcm(long long a,long long b)
{
    return a*b/gcd(a,b);
}

int main()
{
    long 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(){
//	m*n = LCM * GCD
	unsigned long long m, n;
	while(cin >> m >> n){
		int LCM, GCD;
		
		if(m<n){
			int swap;
			swap = m;
			m = n;
			n = swap;
		}

		int m_, n_;
		m_ = m;
		n_ = n;
		do {
			if(n_==0){
				GCD = m_;
				break;
			}
			
			int swap = m_ % n_;
			m_ = n_;
			n_ = swap;
		} while(1);
		
		LCM = (m*n)/GCD;
		cout << GCD << " " << LCM << endl;
	}

	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(){
	int a,b,g,l;
	while(cin>>a>>b){
		g=gcd((a>=b)?a:b,(a>=b)?b:a);
		l=(a/g)*b;
		cout<<g<<" "<<l<<endl;
	}
	return 0;
}

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

using namespace std;

int GCD(int a, int b){
	if(a < b){
		swap(a, b);
	}
	while(b){
		a %= b;
		swap(a, b);
	}
	return a;
}

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;
	}
	return 0;
}

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

C++: #include<stdio.h>
#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)!=EOF)
    {
        LL c=GCD(a,b);
        printf("%lld %lld\n",c,a/c*b);
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

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

unsigned long long int lcm(unsigned long long int a, unsigned long long int b)
{
	return(a * b / gcd(a, b));
}

void solve()
{
	unsigned long long int a, b;
	while(cin >> a >> b)
	{
		if(a < b)
		{
			unsigned long long int temp = a;
			a = b;
			b = temp;
		}
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

int main(){
  int a, b;

  while(cin >> a >> b){
    int a_lcm = a, b_lcm = b;
    while(a!=0 &&b!=0){
      if(a < b)
	swap(a,b);
      int tmp = b;
      b = a%b;
      a = tmp;
    }
    cout << a << " " << a_lcm/a*b_lcm << endl;

  }
  
  return 0;
}