Go: package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

func gcd(x, y int) int {
	if x < y {
		gcd(y, x)
	}
	for 0 < y {
		r := x % y
		x, y = y, r
	}
	return x
}

func lcm(x, y int) int {
	return (x * y) / gcd(x, y)
}

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

int a,b;

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

int main(){
	while(scanf("%d%d",&a,&b)!=EOF){
		if(a>b)swap(a,b);
		int ans=GCD(a,b);
		printf("%d %d\n",ans,b/ans*a);
	}
}

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

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

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

int main (int argc, char const* argv[])
{
    long long int a,b;
    while(cin >> a >> b){
        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		int i;
		if(a>=b)
			i=b;
		else
			i=a;
		while(true){
			if(a%i==0&&b%i==0)
				break;
			i--;
		}
		cout<<i<<" ";
		if(a>=b)
			i=a;
		else
			i=b;
		while(true){
			if(i%a==0&&i%b==0)
				break;
			i++;
		}
		cout<<i<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(long long ,long long);
int main(){
  long long a,b,c,d;
  while(cin>>a>>b){
  c=gcd(a,b);
  d=a*(b/c);
  cout<<c<<' '<<d<<endl;
  }
  return 0;
}

int gcd(long long x,long long y){
  while(x!=y){
    if(x>y){
      x=x%y;
      if(x==0) return y;
    }
    else{
      y=y%x;
      if(y==0) return x;
    }
  }
  return x;
}

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

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {
  ll a, b;
  while(cin >> a >> b) {
    ll g = gcd(a, b);
    ll l = a * b / g;
    printf("%lld %lld\n", g, l);
  }
}

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

int main()
{
	unsigned int a,b ;

	int gcd = 1 ;
	int lcm = 1 ;

	while( cin >> a >> b )
	{
		for( int i = 2 ; i < min(a,b) ; i ++ )
		{
			if( (a %i == 0 ) && (b %i == 0 ) )
			{
				gcd *= i ;
				a = a/i ;
				b = b/i ;

				i = 2 ;
			}
		}

		lcm = gcd * a * b ;

		cout << gcd << " " << lcm ;

		gcd = 1 ;
		lcm = 1 ;
	}

	return 0 ;
}

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

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

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

int main(){

	int a, b, tmp, gcd, lcm;
	
	while(cin >> a >> b){
	
		if(a > b){
			tmp = a;
			a = b;
			b = tmp;
		}
	
		gcd = a;
		for(int i=2;; i++){
			if(b % gcd == 0 || gcd == 1) break;
			else gcd = a / i;
		}
		
		lcm = b;
		for(int i=2;; i++){
			if(lcm % a == 0) break;
			else lcm = b * i;
		}
	
		cout << gcd << " " << lcm <<endl;
	
	}

	return 0;
}

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

int main(){
	long a,b,x,y,g,l,buf;
	while(cin >> a >>b){
		if(a>b){
			x=a;
			y=b;
		}else{
			x=b;
			y=a;
		}
		while(x%y!=0){
			buf=x;
			x=y;
			y=buf%y;
		}
		cout << y << " " << (a*b/y) << endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(void) {
	int buf,i,c;
	long int a,b,gcd = 1, lcm;
	
	while(scanf("%ld%ld",&a,&b) != EOF){
		if(b > a){buf = a;a = b;b = buf;}
		for(i = 2; a/2 > i;i++){
			if(b%(a/i) == 0) {gcd = a/i;break;}
		}
		for(i = 2; ;i++){
			if((a*i)%b == 0) {lcm = a*i;break;}
		}
		printf("%d %d\n",gcd, lcm);
	}
	
	return 0;
}

C++: #include<iostream>

int main(){
        int a,b;
        while(std::cin >> a >> b){
                int ta,tb,r,gcd,lcm;
                if(a<b){
                        r = a;
                        a = b;
                        b = r;
                }
                ta = a; tb = b;

                r = ta % tb;
                while(r != 0){
                        ta = tb;
                        tb = r;
                        r = ta % tb;
                }
                gcd = tb;
                ta = a; tb = b;
                ta = (int)(ta / gcd);
                tb = (int)(tb / gcd);
                lcm = ta * tb * gcd;
                std::cout << gcd << " " << lcm << std::endl;
        }
        return 0;
}

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

int main(){
	int a = 0;
	int b = 0;
	int max = 0;
	int min = 0;
	int d = 1;
	int a_bk = 0;
	int b_bk = 0;

	while (cin >> a >> b) {
		if (a > b) {
			max = b;
			min = a;
		}
		else {
			max = a;
			min = b;
		}

		a_bk = a;
		b_bk = b;
		d = 1;

		for (int c = 2; c <= max ; c++) {
			while(a%c == 0 && b%c == 0) {
				a /= c;
				b /= c;
				d *= c;
				
			}
		}
		cout << d << "\n";

		a = a_bk;
		b = b_bk;

		for (min; min <= 2000000000; min++) {
			if (min%a == 0 && min%b == 0) {
				cout << min << "\n";
				break;
			}
		}
	}


	return 0;
}

C++: #include<cstdio>

using namespace std;

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

int main(void){
	int a,b;
	int g;

	for(;scanf("%d%d",&a,&b)==2;){
		g=gcd(a,b);
		printf("%d %d\n",g,a/g*b);
	}

	return 0;
}

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

long GCD(long, long);
long LCM(long, long);

long gcd, lcm;

int main(){
	long a, b;
	while(cin >> a >> b){
		if(a < b)
			swap(a, b); // a > b
		gcd = GCD(a, b);
		lcm = LCM(a, b);
		cout << gcd << " " << lcm;
	}
	return 0;
}

long GCD(long a, long b){
	if(b == 0)
		return a;
	else
		return GCD(b, a%b);
}

long LCM(long a, long b){
	return a*b/gcd;
}

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

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

int LCM(int a, int b)
{
    return a / GCD(a, b) * b;
}

int main()
{
    for (int a, b; cin >> a >> b;)
        cout << GCD(a, b) << " " << LCM(a, b) << endl;

    return 0;
}

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

using namespace std;

//?????§??¬?´???°(????????????????????????????????????)
template<class T>T GCD(T a, T b);

//????°???¬?????°(ab == (GCD)(LCM) ??????)
template<class T>T LCM(T a, T b);


int main()
{
	long long a, b;
	cin >> a >> b;
	
	do{
		cout << GCD(a, b) << " " << LCM(a, b) << endl;
	}while( (cin >> a >> b) );
	
	return 0;
}


template<class T>T GCD(T a, T b)
{
	T ans;
	do
	{
		if( a == b )
		{
			ans = a;
			break;
		}
		
		if( a < b )swap(a, b);
		a -= b;
		
	}while( 1 );
	
	return ans;
}

template<class T>T LCM(T a, T b)
{
	return a * b / GCD(a, b);
}