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 <stdio.h>
using namespace std;

int gcd(unsigned long long int num1,unsigned long long int num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(unsigned long long int num1,unsigned long long int num2) {
	return num1 / gcd(num1, num2) * num2;
}

int main() {
	unsigned long long int a, b;
	while (~scanf("%d %d",&a,&b)) {
		if (b > a) {
			unsigned long long int tmp = b;
			b = a;
			a = tmp;
		}
		printf("%d %d\n", gcd(a, b),(unsigned long long int)lcm(a,b));
	}
}

C++: #include<iostream>
using namespace std;
int main(){
bool aaa;
int as,c;
float asd;
int a,b,gcd,lcm;
while(cin>>a>>b){
c=1;
gcd=1;
aaa=true;
while(aaa){
c++;
as=a/c;
asd=a/c;
if(as==asd){
as=b/c;
asd=b/c;
if(as==asd){
gcd*=c;
a/=c;
b/=c;
}
}
if(a==1||b==1){aaa=false;}
}
lcm=a/gcd*b;
cout<<gcd<<" "<<lcm<<endl;
}
}

C++: #include <stdio.h>

int main(void){
    
    int a, b, r, s;
    int temp = 0;
    
    scanf("%d %d", &a, &b);
    s = a * b;
    if(a < b){
        temp = a;
        a = b;
        b = temp;
    }
    
    r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    
    printf("%d %d\n", b, s/b);
    
    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);
	
	else 
	while(true){
		if(a==0||b==0)cout<<"a#";
		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>
using namespace std;
int main() 
{
    long a, b, c, d, tmp;
    while (std::cin >> a >> b) {
    	d = a * b;
		if(a < b) {
            tmp = a;
            a = b;
            b = tmp;
        }
 
    c = a % b;
    while(c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
    cout << b << " " << d / b << endl;
    }
       return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
for(i=0;i<=50;++i){
  cin>>a>>b;
x=a;y=b;
while(x!=y){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
}
L=(a*b)/x;
cout<<y<<" "<<L<<endl;
}
  return 0;
}

C++: #include <iostream>
#include <boost/math/common_factor_rt.hpp>
using namespace std;

int main() {
	int a, b;
	while (cin >> a >> b) {
		int Ngcd = boost::math::gcd(a, b);
		int Nlcm = boost::math::lcm(a, b);
		cout << Ngcd << " " << Nlcm << endl;
	}
	return 0;
}

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

int main() {
	int a,b,c;
	while(cin>>a>>b){
		int g=0,l=0;
		if(a<b){
			c=b;
			b=a;
			a=c;
		}
		while(1){
			int i=1;
			if((i*a)%b==0){
				g=i*a;
			}
			if(g==i*a) break;
			i=i+1;
		}
		while(1){
			int i=2;
			if(a%i==0){
				if(b%(a/i)==0){
					l=a/i;
				}
			}
			i=i+1;
			if(l!=0) break;
		}
		cout<<g<<l<<endl;
	}
	return 0;
}

C++: #include <cstdio>

using namespace std;

#define max( x, y ) ( ( x > y ) ? x : y )
#define min( x, y ) ( ( x < y ) ? x : y )

int main()
{
	char buf[1024];
	int a, b;

	while ( fgets( buf, sizeof( buf ) - 1, stdin ) != NULL && buf[0] != '\n' )
	{
		sscanf( buf, "%d %d", &a, &b );

		for ( int i = min( a, b ); 1 < i; i-- )
		{
			if ( !( a % i ) && !( b % i ) )
			{
				printf("%d ", i );
				break;
			}
		}

		for ( int i = max( a, b ); i <= 2000000000; i++ )
		{
			if ( !( i % a ) && !( i % b ) )
			{
				printf("%d\n", i );
				break;
			}
		}
	}

	return 0;
}

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

int main()
{
	for (unsigned long a, b, x, r; cin >> a >> b; cout << x << ' ' << a << endl) {
		unsigned long at = a, bt = b;
		do {
			r = a%b;
			a = b;
			b = r;
		} while (r);
		x = at*bt / a;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>

#define PI 3.14159265359

#define INF 1000000;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)

typedef long long ll;

using namespace std;


/*
class ElectronicPetEasy
{
public:
	string isDifficult(int st1, int p1, int t1, int st2, int p2, int t2)
	{
		
	}
};
*/


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


int main()
{
	ll a, b;
	ll gcd_num, lcm;
	
	while (cin >> a >> b)
	{
		gcd_num = gcd(a, b);
		lcm = a * b / gcd_num;
		cout << gcd_num << " " << lcm << endl;
	}
	
	return 0;
}

C++: #include <stdio.h>
#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);
//printf("%d %d\n",gcd, lcm);
    //std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = 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;

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

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

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

C++: #include "bits/stdc++.h"
using namespace std;
int main(){
    long long x, y, st;
    while(cin >> x >> y){
        if(x >= y){
            st = gcd(x, y);
            cout << st << " ";
        }else{
            st = gcd(y, x);
            cout << st << " ";
        }
        cout << x * y / st << endl;
    }
    return 0;
}
long long gcd(long long a, long long b){
    int r;
    while(b > 0){
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}

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

int main() {
	int a,b,c,e,f;
	while(cin>>a>>b){
		long long g=0,l=0;
		e=a;
		f=b;
		if(e>f){
			e=e-f;
		}
	    if(f>e){
	    	f=f-e;
	    }
	    if(f==e){
	    	l=e;
	    }
	    if(l!=0) break;
		cout<<l<<" "<<a*b/l<<endl;
	    }
	return 0;
}

C++: #include<bits/stdc++.h>

#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define ALL(obj) (obj).begin(),(obj).end()
#define space <<" "<<
using namespace std;

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

    lcm=a*b;

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

    cout<<a space lcm/a <<endl;
    }
}

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);
	
	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;
	}
}