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 <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

typedef long long ll;

int gcd(int a, int b) {
    return b == 0 ? a : gcd(b,a%b);
}

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

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

C++: #include <stdio.h>
 
using namespace std;
 
int calcMax(int a,int b){
    int tmp;
    if(a > b){
        while(b != 0){
            tmp = b;
            b = a%b;
            a = tmp;
        }
        return a;
    }else{
        while(a != 0){
            tmp = a;
            a = b%a;
            b = tmp;
        }
        return b;
    }
}
 
 
 
int calcMin(int a,int b){
    int max_common = calcMax(a,b);
    return (a/max_common)*b;
}
 
int main(){
    int a,b;
    while(scanf("%d %d",&a,&b)!=EOF){
        printf("%d %d\n",calcMax(a,b),calcMin(a,b));
    }
 
    return 0;
}

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

int main(){
    int a, b, lcm, gcd;
	while(std::cin >> a >> b){
		int _a = a, _b = b;
		while(1){
			if(_b % _a == 0){
				gcd = _a;
				break;
			}
			_a = _a % _b;
			std::swap(_a, _b);
		}
		lcm = a / gcd * b;
		std::cout << gcd << ' ' << lcm << std::endl;
	}
	return 0;
}

C++: 
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
int main()
{
	long long a, b;
	while (cin >> a >> b)
	{
		int A, B;
		A = saisho(a,b);
		B = saidai(a, b);
		cout << A << " " << B<<endl;
	}
	return 0;

}
int saidai(int N, int M)
{
	int n = N, m = M;

	int s = 1;
	while (true)
	{
		if ((s*n) % m == 0)
		{
			break;
		}
		else { s++; }
	}
	return s*n;
}

int saisho(int N, int M)
{
	int n = N, m = M;
	while (true)
	{
		if (n == 0) { return m; break; }
		if (m == 0) { return n; break; }
		if (n > m) { n -= m; }
		else { m -= n; }
	}
}

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;

int main(){
	int a,b;
	while(cin>>a>>b){
		int a2=a;
		int b2=b;
		while(true){
			if(a>b){
				a=a%b;
			}else{
				b=b%a;
			}
			if(a==0||b==0)break;
		}
	cout<<max(a,b)<<" "<<a2/max(a,b)*b2<<endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string>
using namespace std;

int main() {
	
	int a, b;
	int lcm, gcd;
	for (int j = 0;j < 50;j++) {
		cin >> a >> b;
		int i = 2;
		lcm = 1;
		while (i <= a && i <= b) {
			if (a % i == 0 && b % i == 0) {
				lcm *= i;
				a /= i;
				b /= i;
			}
			else i++;
		}
		printf("%d %d\n", lcm, a * b * lcm);
	}

	//system("pause");
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    int a,b,big,small,r;

    while(1){
        cin >> a >> b;
        if(cin.eof()){
            break;
        }
        
        if(a > b){
            big = a;
            small = b;
        }
        else {
            big = b;
            small = a;
        }
        
        r = big % small;
        while(r != 0){
            big = small;
            small = r;
            r = big % small;
        }
        
    }
    
    cout << small << ' ' << (a / small) * (b / small) * small << endl; 

    return 0;
}

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

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

 GCD(b, a%b);
}

int LCM(int a, int b)
{
 int c = GCD(a, b);

 return a*b/c;
}

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

 cout << GCD(a, b) << ' ' << LCM(a, b) << '\n';

 return 0;
}

C++: 
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
    
#define ll (long long)
#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)


using namespace std;


int main(void)
{
    
    int  number1, number2;
    long long answer2 = 0; int answer1;
    int temp;
    int i;
    long long answer2array[1000] = {1};
    int answer1array[1000] = {0};
    int counter = 0;
    
    while(cin >> number1 >> number2)
    {
        /*?????§??¬?´???°???????±???????*/
        int x = 0, y = 0, x2 = 0, x1 = 0;
        if(number1 > number2)
        {
            x = number1;
            y = number2;
            x1 = x;
            x2  = y;
        }
        else
        {
            x = number2;
            y = number1;
            x1 = x;
            x2 = y;
            
        }
        while(x % y)
        {
            temp = (x % y);
            x = y;
            y = temp;
        }
        answer1 = y;
        /*????°???¬?????°????±???????*/
        for(i = 1;i<=x2;i++)
        {
            if((x1*i)%x2 == 0)
            {
                answer2 = (long long)(x1*i);
                break;
            }
        }
        
        answer2array[counter] = answer2;
        answer1array[counter] = answer1;
        counter++;
        }
        REP(i, counter)
    cout << answer1array[i] << " " << answer2array[i] << endl;
    return 0;
    

    }

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    long long int a,b;
    while(scanf("%lld %lld",&a,&b)!=EOF){
        printf("%lld %lld\n",__gcd(a,b),a/__gcd(a,b)*b);
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
int a,b,i;
while(cin>>a>>b){
int max=0,min;
i=1;
while(r!=0){
r=x%y;
x=y;
y=r;
}
max=x;
min=(a/max)*b;
cout<<max<<" "<<min<<endl;
}
return 0;
}

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

int gcd(int a,int b)
{
	return b==0?a: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;
}

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

int main()
{
	int a,b;
	while(true){
		cin >> a;
		if(cin.eof())
			break;
		cin >> b;

		int a1=0,b1=0;
		a1=a;
		b1=b;

		int sum=0;
		while(a1%b1!=0){
			sum = b1;
			b1 = a1%b1;
			a1 = sum;
		}

		int g=0,m=0;
		g=b1;
		m=a/g*b;

		cout << g << ' ' << m << endl;
	}
	return 0;
}

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