Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

C++: #include <iostream>

using namespace std;

int GCD(const int& a, const int& b) {
	int g_a = a;
	int g_b = b;
	if (a == 0 || b == 0)
		return 0;
	while (a != b)
	{
		if (a > b) 
			g_a -= g_b;
		else 
			g_b -= g_a;
	}
	return g_a;
}

int LCM(const int& a, const int& b) {
	int l_a = a;
	int l_b = b;
	if (a == 0 || b == 0)
		return 0;
	return ((l_a / GCD(l_a, l_b)) * l_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 main()
{
	long long int a, b;
	long long int A, B;
	cin >> a >> b;
	long long int c = a;
	long long int d = b;
	if (a <= b)
	{
		while (a != 0)
		{
			long long int r = b%a;
			b = a;
			a = r;
		}
		A = b;
	}
	if (a > b)
	{
		while (b != 0)
		{
			long long int r = a%b;
			a = b;
			b = r;
		}
		A = a;
	}
	B = c*d / A;
	cout << A << " " << B << endl;
	return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;

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

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

int main(){
  long long a,b;

  if(a<b) swap(a,b); 
  
  while(cin>>a>>b){
    long long g = gcd(a,b);
    cout<<g<<" "<<lcm(a,b,g)<<endl;
  }

  return EXIT_SUCCESS;
}

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

inline u_int euclid_alg(const u_int a, const u_int b) {
	return a > b ? a % b : b % a;
}

int main(void) {
	u_int a,b;
	std::vector<u_int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}
	
	for(int i = 0; i < num.size(); i+=2){
		u_int pro = num[i] * num[i+1];
		while(num[i] == 0 || num[i+1] == 0){
			if(a > b){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}
		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int a,b;
int main(){
	while(cin>>a>>b){
		for(int i=a+b;;i--){
			if(a%i==0&&b%i==0){
				cout<<i<<" ";
				goto loop;
			}
		}
		loop:;
		for(int i=1;;i++){
			if(i%a==0&&i%b==0){
				cout<<i<<endl;
				goto age;
			}
		}
		age:;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	
	int a, b, c = 0;
	while (cin >> a, cin >> b)
	{
		for (int i = 1; i <= a, i <= b; i++)
		{
			if (a % i == 0 && b % i == 0)
			{
				c = i;
			}
		}
		cout << c << " " << a*b / c << endl;
	}
	getchar();
	getchar();
	return 0;
}

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

int get_gcd(int a, int b) {
    if (a % b == 0) return b;
    return get_gcd(b, a % b);
}

int main() {
    int a,b;
    while (cin>>a>>b) {
        if (a < b) {
            int tmp = a;
            a = b;
            b = tmp;
        }

        int gcd = get_gcd(a,b);

        int lcm = (a * b) / gcd;
        cout << gcd << " " << lcm << endl;

    }
    return 0;
}

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

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int euclid( int m, int n ) {
	if( n == 0 ) return m;
	return euclid( n, m % n );
}

int max( int a, int b ) {
	if( a > b ) return a;
	return b;
}

int min( int a, int b ) {
	if( a < b ) return a;
	return b;
}

int main(void){

	unsigned long long int a, b, GCD, LCM;

	while( true ) {
		if( cin.eof() ) break;
		cin >> a >> b;
		GCD = euclid( max( a, b ),min( a, b ) );
		LCM = ( a * b ) / GCD;
		cout << GCD << " " << LCM << endl;
	}

    return 0;
}

C++: #include <iostream>

using namespace std;

void keisann(int a, int b) {
	long long ac = a;
	long long bc = b;
	bool d = true;
	do {
		a = a%b;
		if (a == 0) {
			cout << b << " ";
			cout << (ac*bc) / b << endl;
			d = false;
			continue;
		}
		b = b%a;
		if (b == 0) {
			cout << a << " ";
			cout << (ac*bc) / a << endl;
			d = false;
			continue;
		}
	} while (d == true);
}

int main()
{
	int a, b;
	while (cin >> a, a != EOF) {
		cin >> b;
		if (a > b) { keisann(a, b); }
		else if (a < b) {
			int c = a;
			a = b;
			b = c;
			keisann(a, b);
		}
		else if (a == b) {
			cout << "1" << " " << a << endl;
		}
	}
	return 0;
}

C++: #include <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <iomanip>


using namespace std;

typedef unsigned long long ull;
int main(void) {
	ull a, b;
	while(cin >> a >> b){
		if(a < b){
			ull tmp = a;
			a = b;
			b = tmp;
		}
		ull gcd = 1, lcm = a * b;
		for(int i = 2; i <= b; i++){
			while(a > 0 && b > 0 && a % i == 0 && b % i == 0){
				a /= i;
				b /= i;
				gcd *= i;
			}
		}
		lcm /= gcd;
		cout << gcd << " " << lcm << endl;
	}
}

C++: #include <iostream>
using namespace std;
int a1,a2;
int gcd,lcm;

int GCD(int a,int b){
    int i = 2;
    int minimum = min(a,b);
    if (minimum == 0) i = 0;
    else if (minimum == 1) i = 1;
    for(i == 2;i <= minimum; i++){
        if(a % i == 0 && b % i == 0) break;
        else if(i == minimum){
            i = 1;
            break;
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0) lcm = 0;
        else lcm = a1*a2/gcd;
        cout << gcd << " " << lcm << endl;
    }
}

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

int gcd(int a,int b) {
	int r;
	while (1) {
	
			r = a%b;
			if (r == 0) {
				break;
			}
			a = b;
			b = r;	
	}
	return b;
}

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

C++: #include<iostream>
int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	for(int i=0;i<3;i++){
		int a,b;
		std::cin>>a>>b;
		std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl;
		
	}
	return 0;
}

C++: #include <iostream>
#include <math.h>

using namespace std;

int calc_gcj(int a, int b) {
	int A=0, B=0;
	if (a == max(a,b)) {
		A = a;
		B = b;
	} else {
		A = b;
		B = a;
	}
	if (A == B) return A;
	else return calc_gcj(B,A-B);
	return -1;
}

void solve(int a, int b) {
	int gcj = calc_gcj(a,b);
	int lcm = a/gcj*b;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}