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 <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
#include <iterator>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i, a, cont, next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i, a, b, step) repfn(i, a, i < b, i + step)
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

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

int gcd(int a, int b) {
  if (a < b)
    return gcd_h(b, a);
  else
    return gcd_h(a, b);
}

int lcm(int a, int b) {
  int g = gcd(a, b);
  if (g) {
    return (a / g) * b;
  } else {
    return 0;
  }
}

int main(int argc, char **argv)
{
  int a, b;
  while (cin >> a >> b) {
    cout << gcd(a, b) << " " << lcm(a, b) << endl;
  }
  return 0;
}

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

template<class T> inline T gcd(T a, T b) {
    return (a == b) ? a : gcd(b % a, a);
}

template<class T> inline T lcm(T a, T b) {
    return (a / gcd(a, b)) * b;
}

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

C++: #include <iostream>
#define U unsigned
#define L long
using namespace std;

U L gcd(U L L a,U L L b){
	if (a*b==0) return (a==0?b:a);
	else if (b%a==0) return a;
	else return gcd(b,a%b);
}

int main(){
	U L L x,y,g;
	while(cin>>x>>y){
		g=gcd(x,y); cout<<g<<" "<<(x/g)*y<<"\n";
	}
	return 0;
}

C++: #include <iostream>

#define ll long long

using namespace std;

ll gcd(ll x, ll y) {
 ll r;
 
 while(y != 0) {
  r = x % y;
  x = y;
  y = r;
 }

 return x;
}

ll lcm(ll x, ll y) {
 return x * y / gcd(x, y);
}

int main() {
 ll a, b;

 while(cin >> a >> b) {
  cout << gcd(a, b) << " " << lcm(a, b) << endl;
 }

 return 0;
}

C++: #include <iostream>
#include<stdio.h>
using namespace std;
int main() {
	int a, b,i;
	while (cin >> a >> b) {
		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 (a%i == 0 && b%i == 0)
					break;
			}
		}
		cout << i << " ";
		if (a < b) {
			for (i = b; i <= 2000000000; i += b) {
				if (i%a==0)
					break;
			}
		}
		else {
			for (i = a; i <= 2000000000; i += a) {
				if (i%b==0)
					break;
			}
		}
		cout << i << endl;
	}
	return 0;
}

C++: #include <iostream>

//?????§??¬?´???°????±???????????????°??????(m >= n)
int calcGcd(int m, int n);
//????°???¬?????°????±???????????????°??????
inline int calcLcm(int m, int n, int gcd);

int main(){
	int gcd, lcm, a, b;
	
	while(std::cin >> a >> b){
		if(a > b) gcd = calcGcd(a, b);
		else gcd = calcGcd(b, a);
		lcm = calcLcm(a, b, gcd);
		
		std::cout << gcd << " " << lcm << std::endl;
	}
	
	return 0;
}

int calcGcd(int m, int n){
	return n == 0 ? m : calcGcd(n, m%n);
}

inline int calcLcm(int m, int n, int gcd){
	return m / gcd * n;
}

C++: #include <iostream>#include <cstdio>using namespace std;int gcd(int a, int b){int p,q,r;if(a<b){p=b;b=a;a=p;}    while(r!=0){    q=b/a;    r=b%a;    b=a;    a=r;    }    return b;}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 <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
	long long a,b;
	long long tmp=1,tmp_1;

	
	while (cin >> a >> b)
	{

		for (long long i = 1; i <= a; i++)
		{
			if (a%i == 0 && b%i == 0 && tmp < i)
			{
				tmp = i;
			}
			
		}
		tmp_1 = a*b / tmp;

		cout << tmp <<" "<<tmp_1<<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(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;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
    int n, m;
    while (2 == scanf("%d%d", &n, &m)) {
        printf("%d %d\n", __gcd(n, m), n / __gcd(n, m) * m);
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll a,b;
	while(cin>>a>>b)
	{
		ll ans=__gcd(a,b);
		cout<<ans<<" ";
		cout<<a/ans*b<<endl;;
	}
	return 0;
 }

C++: def gcd(a,b)
      return a if b == 0
      gcd(b,a%b)
end
def lcm(a,b)
      return a * b / gcd(a,b)
end
while line = gets
      a,b = line.split.map(&:to_i)
      p "#{gcd(a,b)} #{lcm(a,b)}"
end

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

C++: // B.cpp

#include <iostream>

using namespace std;

int gcd(int, int);
int lcm(int, int);

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

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a <= b){
		max = b, min = a;
	}
	if(min == 0) return max;
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

C++: #include <iostream>

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

int main()
{ 
	int a, b;

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

	return 0;
}

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


 
int main(){
	int in[2],a,b,ans[2],i = 2;
	while(cin >> in[0] >> in[1]){
		a = in[0];
		b = in[1];
		if(a >= b){
			while(a >= 0){
				if(in[0] % a == 0 and in[1] % a == 0){
					ans[0] = a;
					break;
				}
				a--;
			}
		}else if(b >= a){
			while(b >= 0){
				if(in[0] % b == 0 and in[1] % b == 0){
					ans[0] = b;
					break;
				}
				b--;
			}
		}else{
			ans[0] = 1;
		}
		cout << ans[0] << endl;
		a = in[0];
		b = in[1];

		ans[1] = 1;
		while(i <= a or i <= b){
			if(a % i == 0 and b % i == 0){
				a = a / i;
				b = b / i;
				ans[1] = ans[1]*i;
				i = 1;
			}
			i++;
		}
		ans[1] = ans[1]*a*b;
		cout << ans[1] << endl;
		
	}
}