Go: package main

import "fmt"

func GCM(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return GCM(b, a % b)
}

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d", G, L)
	}
}

C++: #include<cstdio>
int g(int x,int y){return y?g(y,x%y):x;}
int main(){
int x,y;
while(~scanf("%d%d",&x,&y))printf("%d %d\n",g(x,y),x*y/g(x,y));
}

C++: #include<iostream>

using namespace std;

long yakusuu(long a,long b){
	int t;
	if(a>=b) t=a;
	if(a<b) t=b;
	
	for(long i=t ;i>=1 ;i--){

			if(a%i==0 && b%i==0){
				return i;
				break;
			}
	}
}

long baisuu(long a,long b){

	for(long i=1;i<=a*b ;i++){
		if(i%a==0 && i%b==0){
			return i;
			break;
		}
	}
}


int main(){


	long a,b;
	long R,L;

	cin >> a >> b;

	R=yakusuu(a,b);
	L=baisuu(a,b);

	cout << R << " " << L <<endl;

	return 0;

}

C++: #include <cstdio>
#include <queue>
#include <algorithm>
#include <vector>

using namespace std;

long long GCD(long long x, long long y){
	if(x < y) swap(x, y);
	long long r = x % y;
	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}
	
	return y;
}

int main(){
	long long a, b;
	while(scanf("%lld%lld", &a, &b) == 2){
		long long gcd = GCD(a, b);
		long long lcm = a / gcd * b;
		printf("%lld %lld\n", gcd, lcm);
	}
}

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

long long gcd(long long a, long long b){
    long long x,r;
    if(a < b){
      x = a;
      a = b;
      b = x;
      }
    for(x = 0; b != 0; x++){
      r = a%b;
      a = b;
      b = r;
    }
    return a;
}
int main(void){
    long long a, b;

    while(cin >> a >> b){
    long long lcm = a*b/gcd(a,b);
    cout << gcd(a,b) << " " << lcm << endl;
}

    return 0;
}

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

int gcd(int a, int b) {

	for (int i = a; i >= 1; i--)
		if(a % i == 0)
			if(b % i == 0)
				return i;



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

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