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;

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

int main()
{
    while (~scanf("%d%d",&a,&b)) {
        printf("%d %d\n",gcd(a,b),a*b/gcd(a,b));
    }
    return 0;
}

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

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

int main(){
	int x[2];
	int max_kyk, min_kbi, a,b;
	while(cin>>x[0]>>x[1]){		
		sort(x, x+2);
		max_kyk = gcd(x[1], x[0]);
		min_kbi = (x[1]/max_kyk)*x[0];
		cout << max_kyk << ' ' << min_kbi << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int gcd(int,int);
int lcm(int,int);
int tes(int,int);

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

int gcd(int a,int b){
  int n;
  n=min(a,b);
  for(int i=n;i>=1;i--){
    if(a%i == 0 && b%i==0)return i;
  }

}
/*
int tes(int a,int b){
  if(b == 0)return a;
  return tes(b,a%b);
}
*/

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

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

double eucAlg(int a,int b);


int main(int argc, char* argv[])
{
	double a,b;	//??\??????
	double c, d;	//??????

	while(cin >> a >> b){

		c = eucAlg(a, b);

		d = a * b / c;
		cout << fixed << setprecision(0) << c << " " << d << endl;
	}
	return 0;
}

//??????????????????????????????
double eucAlg(
	int a,
	int b
	)
{
	double c;

	do
	{
		c = a % b;
		if(c == 0){
			break;
		}
		a = b;
		b = c;

	}while(1);

	return b;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
long long int sub(long long int x,long long int y);
int sort(long long int *a,long long int *b);
int main(){
long long int a,b,c,x,y;
 while(scanf("%lld %lld",&a,&b)!=EOF){
   c=a*b;
   sort(&a,&b);
   while(1){
     if(a==b)break;
     x=sub(a,b);
     sort(&b,&x);
     a=b;
     b=x;
   }
   y=c/b;
   printf("%lld %lld\n",b,y);
 }
}
long long int sub(long long int x,long long int y){
  return x-y;
}
int sort(long long int *a,long long int *b){
  if(*a<*b){
    long long int temp =*a;
    *a=*b;
    *b=temp;
  }
}

C++: #include<iostream>
using namespace std;
int GCD(int a,int b)
	{
		return b==0?a:GCD(b,a%b);
	}
int main()
{
	int a,b;
	while(cin>>a>>b)
	{
		int m=GCD(a,b);
		int n=a*b/m;
		cout<<m<<" "<<n<<endl;
	}	
	return 0;
	
}

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

int getGCD(int a, int b) { return b ? getGCD(b, a%b) : a; }
int main() {
	int a, b, gcd;
	while (cin >> a >> b) {
		gcd = getGCD(a, b);
		cout << gcd << " " << (long long)a*b/gcd << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <stdio.h>
using namespace std;
int gcd(int x,int y){
    if(x<y)swap(x,y);
    int r=1;
    while (r) {
        r=x%y;
        x=y;
        y=r;
    }
    return x;
    
}
int main() {
    int a,b;
    while (cin >> a >> b) {
        cout << gcd(a,b)<< " "<< (long long) a*b/gcd(a, b)<<endl;
    }
}

C++: #include<iostream>
using namespace std;
int GCD( int m, int n )
{
	
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}
int LCM( int m, int n )
{
	
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / GCD(m, n)) * n); 
}
int main()
{
	int n,m;
	while(cin>>n>>m){
		cout<<GCD(n,m)<<" "<<LCM(n,m)<<endl;
	}
}

C++:  #include <bits/stdc++.h>
using namespace std;
int main(){
	long long a,b;
	while(cin >> a >> b){
		cout << __gcd(a,b) << ' ' << a*b/__gcd(a,b) << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
/*
template<class... T>
ostream& operator<<(ostream& os, tuple<T...>& t) {
	for (size_t i = 0; i < tuple_size< tuple<T...> >::value; ++i) {
		if (i) os << " ";
		os << get<0>(t);
	}
	return os;
}
*/
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

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

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ll a, b;
	while ( cin >> a >> b ) {
		ll g = gcd(a, b);
		cout << g << " " << a/g*b << endl;
	}
}

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 << gcd << " " << lcm << 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;

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

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

C++: #include <cstdio>
int gcd(int a,int b) {
	return b?gcd(b,a%b):a;
}
int lcm(int a,int b,int g) {
	return a/g*b;
}
int main() {
	int a,b,g;
	while(scanf("%d %d",&a,&b)!=EOF) {
		g=gcd(a,b);
		printf("%d %d\n",g,lcm(a,b,g));
	}
}

C++: #include <iostream>
using namespace std;
int gcd(int x,int y){
	if(x==0)return y;
	return gcd(y%x,x);
}
int main(){
	while(!cin.eof()){
		int a,b;
		cin>>a>>b;
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
	return 0;
}

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

int main(){
  int a, b, x, y, q, r=1;
  while (cin >> a >> b){
    x=a; y=b;
    while (r>0){
      q=x/y; r=x%y;
      if (r>0){
	x=y; y=r;
      }
    }

    cout << y << " " << a/y*b << endl;
    r=1;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int a,b,c,rest;
	while(1){
		cin >> a>>b;
		int a2=a,b2=b;

		if(a>b){c=a;a=b;b=c;}
		while((rest=b%a)!=0){
			b=a;
			a=rest;
		}

		cout << a <<" "<< a2/a*b2 << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int a,int b){
    while(a>0&&b>0){
        if(a>b)
            a%=b;
        else
            b%=a;
    }
    if(a==0)
        return b;
    else
        return a;
}
int main(){
    int a,b;
    while(cin>>a>>b){
        int c=gcd(a,b);
        int lcm=a*b/c;
        cout<<c<<" "<<lcm<<endl;
    }
    return 0;
}