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 <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) (1e9 + 7);
//const ll MOD = 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);
    ll a, b;
    while (cin >> a >> b) {
        ll g = __gcd(a, b);
        cout << g << " " << a / g * b << endl;
    }
    return 0;
}

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

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

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

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

int main(){
  int a, b;
  while(cin >> a >> b){

    int max = max(a, b);
    int min = min(a, b);

    long gcd = 0, lcm = 0;

    for(int i = 0; i < min; i++){
        if(max % i == 0) 
          gcd = i;
    }
    
    int j = 1;

    while(1){
      if((max * j) % min == 0){ 
        lcm = max * j;
        break;
      }
      else{ 
        j++;
      }
    }
    
    cout << gcd << " " << lcm << endl;
  }
}

C++: #include<iostream>
int e(int a,int b){return(a%=b)?e(b,a):b;}int main(){for(int a,b,c,s;s=!(std::cin>>a>>b).eof();s&&printf("%ld %ld\n",c,a/c*b))c=e(a,b);}

C++: #include<stdio.h>
#include<iostream>
#include<iomanip>

#define ll long long
#define REP(i, a) for(int i=0;i<(int)a;++i)
using namespace std;

ll lcm(ll a, ll b) {
    return a * (b / __algo_gcd(a, b));
}

void solver() {
    ll a,b;
    while(cin>>a>>b){
        cout<<__algo_gcd(a,b)<<" "<<lcm(a,b)<<endl;
    }
}

int main() {
    solver();
    return 0;
}

C++: #include <stdio.h>
 
int yakusuu(int a,int b);
 
int main(void){
int a,b,c;
while(scanf("%d %d",&a,&b)!=EOF){
c=yakusuu(a,b);
printf("%d %d\n",c,(a*b/c));
}
return 0;
}
 
int yakusuu(int a,int b){
int n=2,c=1;
while(n<=a && n<=b){
if(a%n==0 && b%n==0){
a=a/n;
b=b/n;
c=c*n;
}
else{
n=n+1;
}
}
return c;
}

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

int main(){
    int a,b;
    while (cin >> a >> b) {
        int koua,koub;
        koua = a;
        koub = b;
        if(koua < koub) {
            int temp = koua;
            koua = koub;
            koub = temp;
        }
        int r;
        while ((r =koua % koub) != 0) {
            koua = koub;
            koub = r;
        }
        int baia = a, baib = b;
        while(baia != baib) {
            if (baia < baib) {
                baia += a;
            }
            else {
                baib += b;
            }
        }
        cout<< koub << " " << baia << endl;
    }
    return 0;
}

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

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		int gcd = 0;
		long long lcm = 0;
		int r = 0;
		int temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = temp_b;
		cout << gcd << " ";

		lcm = a * b / gcd;
		cout << lcm << endl;

	}

	//getchar();

	return 0;
}

C++:  #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 
 using namespace std;
 
 long long int gcd(long long int p,long long int q)
 {
   return q==0 ? p:gcd(q,p%q);     
 }

 int main()
 {
   long long int n,m;
   while(cin>>n>>m)
   {
     long long kk=gcd(n,m);
     cout<<kk<<" "<<n/kk*m<<endl;             
   }
   //while(1);      
   return 0;    
 }

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

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

	return 0;
}

C++: #include<iostream>

int gcd(int a, int b){
  int k;
  if(b>a){
    k=b;
    b=a;
    a=k;
  }
  while(k!=0){
    k = a % b;
    a = b;
    b = k;
  }
  return a;
}

int main(){
  int a, b;

  while(std::cin >> a >> b){
    std::cout << a*b/gcd(a,b) << " " << gcd(a,b) << std::endl;
  }
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int d(int n,int m)
{
    int t;
    while(m!=0)
    {
        if(n<m) {t=n;n=m;m=t;}
        t=m;
        m=n%m;
        n=t;
    }
    return n;
}
int main()
{
    int t,n,m;
    while(1)
    {
        cin>>n>>m;
        cout<<t<<" "<<n*(m/t)<<endl;
    }
    return 0;
}

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

long GCD(long x, long y) {
    if (x % y == 0) return y;
    else return GCD(y, x % y);
}

int main() {
    long a, b;
    while (cin >> a >> b) {
    long GCD_a, LCM_a;
    GCD_a = GCD(a, b);
    LCM_a = a * b / GCD(a, b);
    cout << GCD_a << ' ' << LCM_a << endl;
    }
}