Go: package main

import "fmt"

func main() {
	var a, b int
	var gcd, lcm int

	for {
		_, err := fmt.Scanf("%d %d", &a, &b)
		if err != nil {
			return
		}

		var big, small int
		// GCD
		if a > b {
			big = a
			small = b
		} else {
			big = b
			small = a
		}

		for {
			if big%small == 0 {
				gcd = small
				break
			} else {
				small, big = big%small, small
			}
		}

		// LCM
		lcm = a * b / gcd

		fmt.Println(gcd, lcm)
	}
}

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

int A[60],B[60];

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

int main(){
	int N;
	for(int i=1;i<=50;i++){
		cin>>A[i]>>B[i];
		if(cin.eof()){
			N=i-1;
			break;
		}
	}
	int res[2];
	for(int i=1;i<=N;i++){
		res[0]=gcd(A[i],B[i]);
		res[1]=A[i]/res[0]*B[i];
		cout<<res[0]<<" "<<res[1]<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
  int a,b,c,max=0,min=0,bet,les,ch1=0,ch2=0;
  vector<int> ayaku;
  vector<int> byaku;
  while(cin>>a>>b){
    bet=a%b;
    if(bet!=0)
      les=b%bet;
    if(bet==0)
      max=b;
    else if(les==0)
      max=bet;
    else{
      for(;;){
	ch1=bet%les;
	if(ch1==0){
	  max=les;
	  break;
	}
	bet=les;
	les=ch1;
      }
    }
    min=(a/max)*b;
    cout<<max<<" "<<min<<endl;
  }
  return 0;
}

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

C++: #include <cstdio>

using namespace std;

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

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

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