Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

constexpr int gcd(int a, int b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}

// deps: gcd
constexpr int lcm(const int &a, const int &b) {
  return a * b / gcd(a, b);
}

void solve() {
  int a, b;
  while (cin >> a >> b) cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
}

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

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

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

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
#define int long long

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

signed main(){
        int a, b;
        while( scanf("%lld %lld", &a, &b) != EOF ){
                int c = gcd(a,b);
                printf("%lld %lld\n", c, (a/c)*(b/c)*c);
        }

        return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <fstream>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 0x3f3f3f3f
#define inff -30000000
using namespace std;
typedef long long ll;
const int MAXN=1e5+10;
const int MAX=2000+10;
ll gcd(ll a,ll b){
    return (!b)?a:gcd(b,a%b);
}
int main(){
    #ifdef SIYU
    freopen("in.txt","r",stdin);
    #endif // SIYU
    ll a,b;
    while(cin>>a>>b){
        ll ans=gcd(a,b);
        cout<<ans<<" "<<a/ans*b<<endl;
    }
    return 0;
}

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

int main(){
	int a, b, c, G, R, L, tmp, r;
	while(cin >> a >> b){
		R = a; L = b;
		if(b > a){
			tmp = a;
			a = b; 
			b = tmp;
		}
		while(1){
			r = a % b;
			if(r == 0) break;
			a = b;
			b = r;
		}

		G = b;
		R = R / G;
		L = L / G;

		cout << G << " "  << R*L*G << endl;
	}
}

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

typedef long long lli;

lli gcd(lli a, lli b) {
  return b == 0 ? a : gcd(b, a%b);
}

lli lcm(lli a, lli b) {
  return *b/gcd(a,b);
}

int main() {
  lli a, b;

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

  return 0;
}

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

int Func_gcd(int num1, int num2){
	int surplus;
	
	while((surplus=num1%num2) != 0){
		num1 = num2;
		num2 = surplus;
	}
	
	return num2;
}

int main()
{
	int gcd, lcm;
	int num1, num2;
	
	while(cin>>num1>>num2){
		gcd = Func_gcd(num1, num2);
		lcm = (num1*num2)/gcd;
				
		cout << gcd << " " << lcm << "\n";
	}
	
	return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;
ll gcd(ll a,ll b)
{
	if(b == 0) return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
	return a*b/gcd(a,b);
}

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

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b;
    while(cin >> a >> b) {
        int g = __gcd(a, b);
        cout << g << ' ' << a / g * b << endl;
    }
}

C++: #include <iostream>
#include <utility>

int main(){

	u_int a, b;

	while(std::cin >> a >> b){

		long int minmul = a * b; //least common multiple
		u_int maxdivi = 1; //greatest common divisor

		if(a == 0 || b == 0){
			std::cout << 0 << " " << 0 << std::endl;

		}else{					//Euclidean Algorithm

			if(b > a)
				std::swap(a, b);

			while(a % b != 0){
				a = a % b;
				if(b > a)
					std::swap(a, b);
			}
		
		maxdivi = b;
		minmul = minmul / maxdivi;

		std::cout << maxdivi << " " << minmul << std::endl;
		}
	}

	return 0;
}

C++: #include <stdio.h>
int gcd(int a,int b)
{
    if(b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    int a, b;
    while(scanf("%d%d", &a, &b) != EOF)
        printf("%d %d\n", gcd(a, b), a / gcd(a, b) * b);
    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 <iostream>

int main() {
	long long int a, b;
	while( std::cin >> a >> b ) {
		long long int m = ( a >= b ) ? a : b, n = ( a >= b ) ? b : a;
		while( n != 0 ) {
			long long int r = m % n;
			m=n; n=r;
		}
		std::cout << m << " ";
		long long int l = a * b / m;
		std::cout << l << std::endl;
	}
}

C++: #include<stdio.h>
int main(){
  long long int a,b,n,i,j;
  while(scanf("%lld %lld",&a,&b)!=EOF){
    if(a>=b){
      n=b;
    }
    else{
      n=a;
    }
    i=a;
    j=b;

    while(1){
      /*   if(n<a){
	n=a%n;
      if(n==0){
	n=a;
	break;
      }
      }
      else if(n<b){
	n=b%n;
      if(n==0){
	n=b;
	break;
      }
      }*/

      n=a%b;
      if(n==0){
	n=b;
	break;
      }else{
	a=b;
	b=n;
      }

    }
    /*
    while(1){
      if(a*i==b*j){
	break;
      }
      else if(a*i<b*j){
	i++;
      }
     else if(a*i>b*j){
	j++;
	   }
	   }*/

    printf("%lld %.0f\n",n,(double)(i)*(double)(j)/(double)(n));
  }
  return (0);
}

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

int max(int a, int b){
    int c;
    
    if(a == 0 || b == 0){
        return 0;
    }
    
    while(a != b){
        if(a > b){
            a = a - b;
        }else{
            b = b - a;
        }
    }
    
    return a;
}

int min(int a, int b){
    int d;
    
    if(a == 0 || b == 0){
        return 0;
    }
    
    d = a * b / max(a, b);
    
    return d;
}

int main()
{
    int a, b;
    
    while(cin >> a >> b){
        cout << max(a, b) << " " << min(a, b) << endl;
    } 
    
    return 0;
}

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