Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		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
		}
		fmt.Printf("%d %d\n", y, lcm/y)
	}
}

C++: #include <cstdio>
#include <utility>
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <map>
#include <string.h>
 
using namespace std;

int gcd(int a,int b){
  if(b==0) return a;
  else gcd(b,a%b);
  }
 
int main(){
  
  int a,b;
 
  while(cin>>a>>b){
    
    if(a>=b) cout<<gcd(a,b)<<' '<<a/gcd(a,b)*b<<endl;
    else cout<<gcd(a,b)<<' '<<b/gcd(a,b)*a<<endl;
    
    }
      
}

C++: #include <iostream>

using namespace std;

int GetGCD(int a, int b) {
    if (a < b) {
        auto temp = a;
        a = b;
        b = temp;
    }

    int r;
    while (true) {
        r = a % b;

        if (r == 0) return b;
        a = b;
        b = r;
    }
}

int GetLCMfromGCD(int a, int b, int gcd) {
    int e = a / gcd;
    return b * e;
}

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

C++: #include<iostream>
int a,b,t;int g(int a,int b){return a<b?g(b,a):(b?g(b,a%b):a);}
main(){while(std::cin>>a>>b)std::cout<<(t=g(a, b))<<' '<<(a/t)*b<<"\n";}

C++: #include <iostream>
#include <fstream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

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

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

C++: #include <stdio.h>

using namespace std;

int calcMax(int a,int b){
	int tmp;
	if(a > b){
		while(b != 0){
			tmp = b;
			b = a%b;
			a = tmp;
		}
		return a;
	}else{
		while(a != 0){
			tmp = a;
			a = b%a;
			b = tmp;
		}
		return b;
	}
}



int calcMin(int a,int b){
	int max_common = calcMax(a,b);
	return (a/max_common)*b;
}

int main(){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		printf("%d %d\n",calcMax(a,b),calcMin(a,b));
	}

    return 0;
}

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

int main(){
   int a = -1;int b = 0;int i = 1;int g = 0;int seki = 1;
	   cin >> a >> b >>;
          seki = a*b;
	if(a == -1){
		break;
		}
	if(a < b){
		i = a;
		a = b;
		b = i;
		}
for(i = 1;i <= 50;i++){
   
if(b == 1){
  g = a;
  break;
  }
else {
 a = a%b;
 i = a;
 a = b;
 b = i;
 }
}
cout >> g >> " " >> seki / g >> endl;

    return 0;
}

C++: #include<iostream>
#define nijuoku 2000000000

using namespace std;


int saidaikouyaku(long long int a, long long int b){
    int big    = max(a,b);
    int little = min(a,b);
    
    for(long long int i = little; i > 1; --i){
        if(little % i == 0 && big % i == 0)return i;        
    }
    return -1;
}

int saisyoukoubai(long long int a, long long int b){
    
    int big    = max(a,b);
    int little = min(a,b);
    
    for(long long int i = big; i < nijuoku; i += big){
        if(i % little == 0)return i;        
    }
    return -1;
};


            
int main(){

    long long int a, b;
    
    while(cin >> a >> b){
        cout << saidaikouyaku(a,b) << ' ' << saisyoukoubai(a,b) << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
while(i=0;i<=50;++i){
  cin>>a>>b;
x=a;y=b;
while(1){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
  else if(x==y){break;}
}
L=(a*b)/x;
if(x==1){cout<<y<<" "<<y<<endl;}
else{cout<<y<<" "<<L<<endl;}
}
  return 0;
}

C++: #include <stdio.h>
int GCD(int a,int b){
	int r=a%b;
	if(r==0) return b;
	return GCD(b,r);
}
int main(){
	int a,b,g,l;
	while(scanf("%d%d",&a,&b)!=EOF){
		g = GCD(a,b);
		l = (a/g)*b;
		printf("%d %d\n",g,l);
	}
	return 0;
}

C++: #include<stdio.h>
int GCD (int a, int b) {
	return b ? GCD (b, a % b) : a;
}
int LCM (int a, int b) {
	return a / GCD (a, b) * b;
}
int main () {
	int a, b;
	while (~scanf("%d%d", &a, &b)) {
		printf("%d %d\n", GCD(a, b), LCM (a, b));
	}
	return 0;
}

C++: // includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve
ll gcd(ll x, ll y){
  if(x > y)return gcd(y, x);
  if(x == 0)return y;
  return gcd(y % x, x);
}

int main(int argc, char const* argv[])
{
  ll x, y;
  while(cin >> x >> y){
    ll tmp = gcd(x, y);
    cout << tmp << " " << x * y / tmp << endl;
  }
	return 0;
}

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

int main() {
	double a, b, c, d;
	while(1) {
		cin >> a >> b;
		c = a;
		d = b;
		while (1) {
			if (fmod(max(a, b), min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a  = fmod(a,b);
			}else b = fmod(b,a);
		}
			cout << " " << c * d / min(a,b) << endl;
	}

	return 0;
}