Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if count == 51 {
			break
		}
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

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

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    gcd = u(a, b);
    lcm = l(a, b);
printf("%d %d\n",gcd, lcm);
    //std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

int l(int a, int b){
  int i = 2;
  
  while(1){
    if(a%i==0){
      if(b%i==0){return i;}
      else{i++;}
    }else{
      i++;
    }
  }
}

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

int main(){
		int a, b;
		while(cin >> a >> b){
				int gcd;
				vector<int> divisor_a;
				vector<int> divisor_b;
				for(int i = 2; i <= a; i++){
						if(a % i == 0) divisor_a.push_back(i);
				}
				for(int i = 2; i <= b; i++){
						if(b % i == 0) divisor_b.push_back(i);
				}
				for(int i = 0; i < divisor_a.size(); i++){
						for(int j = 0; j < divisor_b.size(); j++){
								if(divisor_a[i] == divisor_b[j]) gcd = divisor_a[i];
						}
				}
				cout << gcd << " " << a * b / gcd << endl;
		}
		return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

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

int main()
{
	lld a,b;
	while(cin >> a >> b)
	{
		lld n = min(a,b);
		lld m = max(a,b);
		lld sol = gcd(m,n);
		cout << sol << endl;
		cout << n * m / sol << endl;
	}


	return 0;
}

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

int gcd(int a, int b);
int lcm(int a, int b);

int main(){
	int a, b;
	while(cin >> a >> b){
		while(!(((a > 0)&&(a <= 2000000000))&&((b > 0)&&(b <= 2000000000)))){
			cout << "wrong value\n";
			cin >> a >> b;
		}
		cout << gcd(a, b) << " " << lcm(a, b) << "\n";
	}
    return 0;
}

//Greatest Common Divisor
int gcd(int a, int b){
	while(a != b){
		if(a > b) a = a - b;
		else b = b - a;
	}
	return a;
}

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

C++: #include <cstdio>
#define LOOP(index,times) for(int index=0;index<times;index++)
using namespace std;

int main(){
long a,b,r;
while(scanf("%ld %ld",&a,&b) != EOF){
	
	long c=a*b;
			
	if(b>a){r=a; a=b; b=r;}

	while(1){
	r=a%b;
	if(r==0) break;
	a=b; b=r;		
	}
	printf("%ld %ld\n",b,c/b);
}
return 0;		
}

C++: #include "stdio.h"

int main()
{
	int a, b, x, y;

	while(scanf("%d %d", &a, &b) != EOF){
		if(a < b) {int t; t = a; a = b; b = t;}

		for(int i = a-b; i > 0; i--){
			if(a%i == 0 && b%i == 0) {x = i; break;}
		}

		y = a/x*b;

		printf("%d %d\n", x, y);
	}

	return 0;
}

C++: #include<stdio.h>

long gcd(long a,long b);

int main(){
  /*
  int a = 0,b = 0,c = 0,d = 0,e = 0,f = 0;

  while(fscanf(stdin,"%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f) != EOF){
    printFunc(a,b,c,d,e,f);
  }
  */

  long a = 0,b = 0;

  while(fscanf(stdin,"%d %d",&a,&b) != EOF){
    printf("%d %d",gcd(a,b),a*b/gcd(a,b));
  }

  return 0;
}

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

C++: #include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <string>

using namespace std;
int main()
{

double x,y,r,a,b;

cin>>x>>y;
a=x;
b=y;
while(x%y!=0)
{
r=x%y;
x=y;
y=r;
}
cout<<y<<" "<<a*b/y<<endl;
return 0;
}

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

int main() {
	long a,b;
	long c= a,d = b;
	while (cin>>a>>b){
	while(true){
		if(c%d == 0)break;
		d = c % d;
		c = d;
	}
	}cout<<d<<" "<<a*b/d<<endl;
}

C++: #include <iostream>

int get_GCD(u_int a, u_int b)
{
    while(a != 0 && b != 0){
        if(a >= b)
            a %= b;
        else
            b %= a;
    }
    return a != 0 ? a : b ;
}

int main()
{
    u_int a, b, GCD;
    while(std::cin >> a >> b){
            GCD = get_GCD(a, b);
            std::cout << GCD << " " << a * (b / GCD) << std::endl;
    }    

    return 0;
}

C++: #include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<algorithm>

int gcd(int a, int b)
{
if(b==0)
return a;
else
return gcd(b,a%b);
}
int main()
{
int x,y,z,lcm;
while(x!=0||y!=0){
scanf("%d%d",&x,&y);
z=gcd(x,y);
lcm=(x*y)/z;
printf("%d %d\n",z,lcm);
}
return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long int ll;
void solve(ll a ,ll b)
{
    ll a1=a,b1=b,t;
    while(b1!=0){//cout<<a1<<" ! "<<b1<<endl;
        t=b1;
        b1=a1%b1;
        a1=t;

    }
    cout<<a1<<" "<<a*b/a1<<endl;
}
int main()
{
    ll a,b;
    while(cin>>a>>b)
    {
        if(a<b)swap(a,b);
        solve(a,b);
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
using lli = unsigned long long int;

lli GCD(lli a,lli b);
lli LCM(lli a,lli b);

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

lli GCD(lli a,lli b){
    if(a<b)
        swap(a,b);
    lli r = 1;
    while(r!=0){
        r = a%b;
        a = b;
        b = r;
    }
    return a;
}

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

C++: #include<iostream>

using namespace std;

int main() {
	int a, b, c, d, i, m;
	while (cin >> a >> b) {
		for (i = 0;i < b;i++) {
			for (m = 0;m < a;m++) {
				if (a*(i + 1) == b*(m + 1)) {
					c = a*(i + 1);
					i = -1;
					break;
				}
			}
			if (i == -1) { break; }
		}
		if(a > b){
			for (i = a;i > 0;i--) {
				if (a%i == 0 && b%i == 0) { break; }
			}
		}else{
			for (i = b;i > 0;i--) {
				if (b%i == 0 && a%i == 0) { break; }
			}
		}
		d = i;
		cout << c << ' ' << d << 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;


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

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

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

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

int gcd(int n, int m) {
  if (n == 0) {
    return m;
  } else if (m < n) {
    return gcd(m, n);
  } else {
    return gcd(m % n, n);
  }
}


int main() {
  long long int n, m;
  while ((cin >> n >> m)) {
    long long int gcd_nm = gcd(n, m);
    long long int lcm_nm = n * m / gcd_nm;
    cout << gcd_nm << " " << lcm_nm << endl;
  }
}