Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, l := GCDandLCM(i)
		fmt.Println(g, l)
	}

}

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

int gcm_sub(int c,int d)
	{
		if (c % d == 0)
			return d;
		else
			return gcm_sub(d,c % d);
	}
int gcm(int a,int b)
{
	if (a >= b) 
		return gcm_sub(a,b);
	else if (b > a)
		return gcm_sub(b,a);
}

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

int main()
{
	int a[2];
	int i=0;
	int n1,n2;
	while(cin >> n1 >> n2){
		// cout << sizeof(a) / sizeof(a[0]) << endl;
		cout << gcm(n1,n2) << ' ' << lcm(n1,n2) << endl;
	}
	
	return 0;
}

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

using namespace std;

int gcd(int a, int b) {
    return b > 0 ? gcd(b, a % b) : a;
}
int main() {
    int  a, b;
    while (scanf("%d%d", &a, &b) != EOF) {
        printf("%d %lld", gcd(a, b), (ll)a / gcd(a, b) * b);
    }

    return 0;


}

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

using namespace std;

int64_t rez(int64_t a, int64_t b)
{
   if(b == 0)return a;
   else
   return rez(b, a%b);
}

int main()
{
int64_t a, b, cc;
while(a != -1)
{
   cin >> a >> b;
   cc = rez(a, b);
   cout << rez(a, b) <<' ' << (a*b)/rez(a, b) << endl;
}
}

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

int main(){
	vector<double*> data;
	while(!cin.eof()){
		int a,b,c,d,e,f;
		cin >> a >> b >> c >> d >> e >> f;
		double x[2];
		x[0] = (double)(c*e - f*b)/(a*e - d*b);
		x[1] = (double)(a*f - d*c)/(a*e - d*b);
		if(x[0] == 0)x[0] = 0.;
		if(x[1] == 0)x[1] = 0.;
		data.push_back(x);
	}
	vector<double*>::iterator it = data.begin();
	for(;it != data.end();++it)
		printf("%.3f %.3f",(*it)[0],(*it)[1]);
	return 0;
}

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

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

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int a, b;
    while(std::cin >> a >> b){
        std::cout << GCD(a, b) << " " << LCM(a, b) << "\n";
    }
    
    return 0;
}

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

typedef long long int LLI;

LLI a, b;

LLI extgcd(LLI a, LLI b, LLI &x, LLI &y) {
  LLI p;

  if (b == 0) {
    x = 1;
    y = 0;
    p = a;
  } else {
    p = extgcd(b, a%b, y, x);
    y -= (a/b)*x;
  }

  return p;
}

int main() {
  while (1) {
    if (scanf("%lld%lld", &a, &b) != 2) break;

    LLI x, y;
    LLI g = extgcd(a, b, x, y);
    printf("%lld %lld\n", g, a/g*b);
  }
}

C++: #include <iostream>
#include <cstdio>
#include <queue>
#include <vector>
#include <cstring>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#define l(u) (u<<1)
#define r(u) (u<<1|1)
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1
#define root 1, n, 1
#define BUG puts("I am bug")
#define XY(x, y) printf("(%d %d)\n", x, y)
typedef long long ll;
using namespace std;

int dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
const int MAXN = 1010;


int main() {
    ios_base::sync_with_stdio(0);
    ll a, b;
    while (cin >> a >> b)
    {
        ll ans1 = __gcd(a, b);
        ll ans2 = a * b / ans1;
        cout << ans1 << ' ' << ans2 << '\n';
    }
    return 0;
}

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

#define MAX 256

int f(int x, int y){
	if (y == 0)return x;
	return f(y, x%y);
}

int main(void){
	
	long max[50], min[50];
	for (long i = 0; i < 50; i++){
		max[i] = 0;
		min[i] = 0;
	}

	long a, b;
	long i = 0;

	while (scanf("%d%d", &a, &b) != EOF){
		max[i] = f(a, b);
		long j = 1;
		while (min[i] == 0){
			if ((a*j) % b == 0)min[i] = a*j;
			j++;
		}
		i++;
	}

	for (long j = 0; j < i; j++){
		printf("%d %d\n", max[j], min[j]);
	}

	return 0;
}

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

using namespace std;

long long a, b;
long long int gcd, lcm;

void GCD(){

	int big, small;

	big = a;
	small = b;

	while (big) {
		if (small > big) swap(big, small);
		big = big % small;
	}
	gcd = small;

}

void LCM() {
	lcm = a * b / gcd;
}




int main(){
	while (cin >> a >> b) {

		GCD();
		LCM();
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

int gcd(int x,int y){
  if(x%y==0) return n;
  else{
    int z=x%y
    return gcd(y,z);
  }
}

int main()
{
  int a,b;
  int g;
  long int l;
  cin >> a >> b;
  
  if(a>b) g=gcd(a,b);
  else if(a<b) g=gcd(b,a);
  else g=a;

  l=a*b/g;
  cout << g << " " << l << " " << endl;

  return 0;
}

C++: #include<iostream>
using namespace std;
 
int gcd(int a,int b)
{
  int tmp;
  if(a>b){
    tmp = a;
    a = b;
    b = tmp;
  }
  if(a == 0){return b;}
  else{return gcd(b%a,a);}
}

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

int main()
{
  int a,b;

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

C++: #include <iostream>

using namespace std;

int gcd( int m, int n ){
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

int lcm( int m, int n ){
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

int main(){
 cout << gcd(8,2) << " "<< lcm(8,4) << endl;
}

C++: #include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int v[100000];

void division(long int a,long int b,long int *L,long int *G){
  long int i;
  int j=0;
  for(i=2;i<2000000000;i++){
    if(a%i==0 && b%i==0){   //a??¨b?????¨???????????????????????????
      a/=i;  b/=i;
      v[j]=i;    //?????£???????????\????????????
      i--;
      j++;   //?????£?????????????´???´???
    }
    if(i>a || i>b){
      break;
    }
  }
  for(i=0;i<j;i++){
    (*G) *=v[i];
  }
  *L = (*G) * a * b;
}

int main(void){
  long int GCD=1;
  long int LCM=1;
  long int a,b;

  while(cin>>a>>b){
    GCD=1;LCM=1;
    division(a,b,&LCM,&GCD);
    printf("%d %d",GCD,LCM);
  }
  printf("\n");

  return 0;
  
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define iREP(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

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

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

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