Go: package main

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

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

C++: #include <bits/stdc++.h>
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 / gcd(a, b) * b;
// }

int64_t gcd(int64_t a, int64_t b) {
  if (a == 0 || b == 0) return a + b;
  return (a < b ? gcd(a, b - a) : gcd(b, a - b));
}

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

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

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

using namespace std;

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

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

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

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

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

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0) return i;
      else i++;
    }else{
      i++;
    }
  }
}

C++: #include <iostream>

using namespace std;


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

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

void solve()
{
	int m, n;
	while(cin >> m >> n)
	{
		int g = gcd(m, n);
		cout << g << " " <<	lcm(m, n, g) << endl;
	}
}

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

C++: #include <iostream>
using namespace std;
int main(){
int a,b;
while(cin>>a>>b){
int max=0,min;
for(int i=a;max==0;i--){
if(a%i==0 && b%i==0){
max=i;}}
min=(a/max)*b;
cout<<max<<" "<<min<<endl;
}
return 0;
}

C++: #include<iostream>
int GCD(int x,int y){
	while(x%y!=0){
		int z=x%y;
		x=y;
		y=z;
	}
	return y;
}
int main(){
	int a=0,b=0;
	while(std::cin>>a>>b){
		std::cout<<GCD(a,b)<<" "<<a*b/GCD(a,b)<<std::endl;
	}
	std::system("pause");
	return 0;
}

C++: #include<cstdio>
typedef long long lolo;
lolo gcd(lolo a, lolo b){
  if(b == 0)
    return a;
  else
    return gcd(b,a%b);
}
void solve(lolo a, lolo b){
  lolo ans = gcd(a,b);
  printf("%lld %lld\n",ans,a / ans * b);
}
int main(){
  lolo a;
  lolo b;
  while(scanf("%lld %lld",&a,&b) != EOF)
    solve(a,b);
}

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


#define N 1024

int main()
{
	char buff[N];
	
	while (NULL != fgets(buff, N, stdin))
	{
		int a, b;
		sscanf(buff, "%ld %ld", &a, &b);
		
		int  m, n, k;
		m = a;
		n = b;
		do
		{
			k = m % n;
			m = n;
			n = k;
		} while (0 != k);
		
		printf("%d %d\n", m, a * (b / m));
	}
	return 0;
}

C++: #include <cstdio>

int getGCD(int a, int b)
{
        if (!b) {
                return a;
        }

        return getGCD(b, a % b);
}

int getLCM(int a, int b)
{
        int lcm = a;

        while (lcm % b) {
                lcm+=a;
        }

        return lcm;
}

int main()
{
        int a, b;

        while (scanf("%d %d", &a, &b)) {
                int max = (a > b) ? a : b,
                    min = (a < b) ? a : b;
                printf("%d %d\n", getGCD(max, min), getLCM(max, min));
        }

        return 0;
}

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

void change(long long *a,long long *b);
long long gcd(long long x,long long y);
long long lcm(long long x,long long y);


int main(void){
	long long a, b, gcd1, lcm1;
	while(cin >> a >> b){
		gcd1 = gcd(a,b);
		lcm1 = lcm(a,b);
		
		cout << gcd1 << ' ' << lcm1 << endl;
	}
	return 0;
}

void change(long long *a,long long *b){
	long long temp;
	temp = *a;
	*a = *b;
	*b = temp;
}

long long gcd(long long x,long long y){
	if(x < y)
	change(&x, &y);
	
	while(y){
		x %= y;
		change(&x, &y);
	}
	return x;
}

long long lcm(long long x,long long y){
	long long ans = x*y / gcd(x, y);
	return ans;
}

C++: #include <iostream>

int main(void)
{
	uint32_t a = 0;
	uint32_t b = 0;

	while (std::cin >> a >> b)
	{
		uint32_t a2 = a;
		uint32_t b2 = b;
		if (a < b)
		{
			uint32_t tmp = a;
			a = b;
			b = tmp;
		}
		uint32_t r = 0;
		while (r = (a % b))
		{
			if (r == 0)
			{
				break;
			}
			a = b;
			b = r;
		}
		std::cout << b << " " << a2/b*b2 << std::endl;
	}

	return 0;
}

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

int main()
{
	long int a,b,i,k;

	while(cin>>a>>b){
		long int x=1, y=0;	//x最大公約数 y最小公倍数
		long int large ,small;

		//最小公倍数を求める処理
		if(a<b){small=a; large=b;}
		else{small=b; large=a;}
		for(i=large ;y==0 ;i+=large){
			if(i%small==0) y=i;
		}
		
		//最大公約数を求める処理
		long int ans[1000];
		i=2; k=0;
		while(a>=i && b>=i){
			if(a%i==0 && b%i==0){
				ans[k]=i;
				a/=i; b/=i;
				k++;
			}else{
				i++;
			}
		}
		for(i=0 ;i<k ;i++) x*=ans[i];

		cout<<x<<" "<<y<<endl;
	}
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int gcd(int a, int b){
    int tmp,q,r;
    if(a<b){
        tmp=b;
        b=a;
        a=tmp;
        }
        while(1){
        q=b/a;
        r=b%a;
        b=a;
        a=r;
        }
        return b;
        }
int main(void){
    int a, b;
    while(cin >> a >> b) {
        int lcm = a/gcd(a,b)*b;
        cout << gcd(a,b) << " " << lcm << endl;
        }
        return 0;
    
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	long long a,b,yakuans,baians;
	while(cin>>a>>b){
		long long c;
		c=a*b;
		if(b>a)swap(a,b);
		while(1){
			long long r;
			r=a%b;
			if(a%b==0)break;
			a=b;
			b=r;
		}
		baians=c/b;
		cout<<b<<" "<<baians<<endl;
	}
	return 0;
}

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

using namespace std;

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

	scanf("%d %d", &a,& b);
	ta = a;
	tb = b;

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

	d = b * (a  / c);

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

	return (0);
}

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

using namespace std;

int main() {
	long a, b;
	while (cin >> a >> b) {

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

}

C++: #include <cstdio>
#define ll long long
ll gcb(ll a, ll b) {
    return a ? gcb(b % a, a) : b;
}
ll a, b;
int main() {
    while (~scanf("%lld %lld", &a, &b)) {
        if (a > b) {
            ll t = a;
            a = b;
            b = t;
        }
        ll g = gcb(a, b);
        printf("%lld %lld\n", g, a * b / g);
    }
    return 0;
}

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

int gcd(int x,int y);
int lcm(int x,int y);

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

int gcd(int x,int y){
  int z;
  while(y != 0){
  z = x%y; 
  x = y;
  y = z;
  }
  return x;
}

int lcm(int x,int y){

  return x/gcd(x,y)*y;

}