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 <cstdio>
#include <cmath>

using namespace std;

int main()
{
    int a,b;

    while(scanf("%d%d",&a,&b)!=EOF){
        int gcd,lcm;

        int less=(a<b)? a:b;
        int greater=(a<b)? b:a;

        for(int i=2;i<=greater;i++){
            if((a%i==0)&&(b%i==0)) gcd=i;
        }

        for(int i=greater;i<=2000000000;i++){
            if((i%a==0)&&(i%b)==0){
                lcm=i;
                break;
            }
        }

        printf("%d %d\n",gcd,lcm);
    }

    return 0;
}

C++: #include "bits/stdc++.h"
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()
#define PB push_back
#define MP make_pair
using namespace std;
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int main(){
    int a,b;
    while(cin>>a>>b){
        if(a<b)swap(a,b);
        int g=gcd(a,b);
        cout<<g<<a/g*b<<endl;
    }
}

C++: #include<iostream>

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

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

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

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

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

int main()
{
	int a, b;
	while (scanf_s("%d%d", &a, &b))
	{
		int g = gcd(a, b);
		int lcm = a / g*b;
		printf("%d %d\n", g, lcm);
	}
}

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

int main(){
	int a, b;
	int multi;

	while(cin >> a >> b){
		multi = a*b;

		if(a<b){
			swap(a, b);
		}

		while(b != 0){
			int t;
			t = b;
			b = a % b;
			a = t;
		}

		cout << a << ' ' << multi/a << endl;
	}

	return 0;
}

C++: //0005
#include <bits/stdc++.h>
using namespace std;

int main(){
    double a,b;

    while(cin>>a>>b){
        cout<<gcd(a,b)<<" "<<a / gcd(a,b) * b <<endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
  long long int x, y;
  while(cin >> x >> y) {
    if (x < y) swap(x, y);
    long long int X = x, Y = y;
    while(1) {
      x %= y;
      swap(x, y);
      if(y == 0) break;
    }
    cout << x << ' ' << X * Y / x << endl;
  }
}

C++: #include<iostream>
using namespace std;
main()
{
	while(1)
	{
	
	long long a,b,c,d,num1,num2;
	
	cin>>a;
	if(a==EOF)
	   break;
	cin>>b;
	num1=a;num2=b;
	
	for(;b!=0;)
    {
    	c=a%b;
    	a=b;
    	b=c;
	}
	d=num1*num2/a;
	cout<<a<<" "<<d<<endl;
	
    } 
 }

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;

long long int gcd(long long int m,long long int n){
	if(m==0||n==0){
		return 0;
	}
	while(true){
		if(m>n){
			m %=n;
			if(m==0){
				return n;
			}
		}
		else{
			n %=m;
			if(n==0){
				return m;
			}
		}

	}
}
long long int lcm(long long int m,long long int n){
	if(m==0||n==0){
		return 0;		
	}
	else{
		return ((m/gcd(m,n))*n);
	}
}

int main() {
	long long int a,b,G,L;
	while(true){
		cin>>a>>b;
		if (cin.eof())break;
		G=gcd(a,b);
		L=lcm(a,b);
		cout<<G<<" "<<L<<endl;
	}
}

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

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

int main(){
	long a,b;
	while(!cin.eof()){
		cin >> a >> b;
		long g = gcd(a,b);
		cout << g << " " << a*(b/g) << endl;
	}
	return 0;
}

C++: nclude <iostream>

#include <cstdio>

#include <algorithm>

using namespace std;

int main(){

	unsigned long long a,b,c,d,e,f,maxx=0,data,minn=0,data2,m=0,n=0;

	while (scanf("%llu %llu",&a,&b)!=EOF){

		data=max(a,b)

		for (;;){

			if (a%data==0 && b%data==0){

				maxx=data;
				
				break;

			}

			data-=1;

		}

		data=min(a,b);

		data2=max(a,b);

		while(minn==0){	
	
			if (m!=0){

				if (data>=data2){

					n=data2;

					data2=data;

					data=n;

				}

				else{	

					n=data;

					data=data2;

					data2=n;
				
				}

				data*=2;

				m=1;

				if (data==data2) minn=data;	

			}		

		}

		cout<<maxx<<" "<<minn<<endl;

		maxx=0;

		minn=0;

	}

	return 0;

}