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 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>
int gcd(int a,int b);
int lcm(int a,int b);
int main(void){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		printf("%d %d\n",gcd(a,b),lcm(a,b));
	}
	return 0;
}

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

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

C++: #include<cstdio>
#include<iostream>
     
using namespace std;
    
int GCD(int a, int b){
  int ans;
  int big, small;
     
  big = a;
  small = b;
     
  while (big) {
    if (small > big) swap(big, small);
    big = big % small;
  }
  ans = small;

  return ans;
}
     
int LCM(int a, int b, int gcd) {
  int ans;
  
  ans = a / gcd * b;

  return ans;
}
     
     
     
     
int main(){
  int a, b;
  int gcd, lcm;

  while (cin >> a >> b) { 

    gcd = GCD(a, b);
    lcm = LCM(a, b, gcd);

    cout << gcd << " " << lcm << endl;
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,i,ii,iii,maxkouyakusuu=0,lowkoubaisuu=20000000000000;
while(i>50){
cin>>a>>b;
for(ii=0;ii<a*b;++ii){
  if(a%ii==0 && b%ii==0 && ii>maxkouyakusuu){
    maxkouyakusuu=ii;
  }
for(iii=0;iii<a*b;++iii){
  if(iii%a==0 && iii%b==0 && iii<lowkoubaisuu){
    lowkoubaisuu=iii;
  }
}
}
  cout<<maxkouyakusuu<<" "<<lowkoubaisuu<<endl;
  ++i;
}
  return 0;
}

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

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

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

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

using namespace std;

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

int main()
{
	long long a, b, t;
	while (scanf("%lld%lld", &a, &b) != EOF)
	{
		if (a < b)
			t = gcd(b, a);
		else
			t = gcd(a, b);
		printf("%lld %lld\n", t, a * b / t);
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	long a, b;
	long gcd;
	while (cin >> a >> b) {
		for (int i = min(a,b); i > 0; i--){
			if (a%i == 0 && b%i == 0){
				gcd = i;
				cout << i << " ";
				goto Cs;
			}
		}
		Cs:
		cout << a /gcd * b << endl;
		for (int i = 0; i < 0; i++){}
	}
}

C++: #include<iostream>
using namespace std;
int main(){
    long int a,b;
    while(cin>>a>>b){
        if(b>a)swap(a,b);
        long long int lcm=(long long int)a*b;
        while(a%b){
            long int c=a%b;
            a=b;
            b=c;
        }
        cout<<b<<" "<<lcm/b<<endl;
    }
}

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    long long a,b,i,f,j;
    while(cin>>a>>b){
    for(i=15000000;i>0;i--){
        if(a>=2000000000||b>=2000000000||a<1||b<1){
            break;
        }
        if(a%i==0&&b%i==0){
            f=a*b/i;
            cout<<i<<" "<<f<<endl;
                break;
        }
    }
    }
    return 0;
}

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

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int a,b;
	while(cin>>a>>b){
		int64_t g=gcd(a,b);
		cout<<g<<" "s<<a/g*b<<"\n"s;
	}
}

C++: #include <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define IREP(it,array) for(vector<int>::iterator it=array.begin(); it!=array.end(); ++it)
#define SREP(it,array) for(vector<string>::iterator it=array.begin(); it!=array.end(); ++it)
#define MP make_pair
typedef long long LL;

LL gcd( LL m, LL n )
{
  if((0 == m) || (0 == n))
    return 0;
	
  while(m != n)
    {
      if (m > n)
	m -= n;
      else
	n -= m;
    }
  return m;
}
LL lcm( LL m, LL n )
{
  if(( 0 == m ) || (0 == n))
    return 0;
	
  return ((m*n) / gcd(m, n));
}

int main()
{
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(6);

  int INF = 1000000;

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


  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
 long long int a, b, c, temp, min, A, B;
 while(cin >> a >> b){
  if(a < b){
    temp = a;
    a = b;
    b = temp;
  }

    
  else if(a >= b){
    A = a;
    B = b;

    while(1){
      c = A % B;
      if(c == 0) break;
      else if(c != 0){
        A = B;
        B = c;
      }
    }
    min = (a * b) / B;
    cout << B << " " << min << endl;

  }
 }
 return 0; 
}

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

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

C++: #include <stdio.h>

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

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

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

using namespace std;

int find_GCD(int a, int b){
  int max = 0;
  for(int i=min(a, b)/2+1;i>0;i--){
    if(a%i==0 && b%i==0){
      max = i;
      break;
    }
  }
  return max;
}

int main(){
  int a, b;
  while(cin >> a >> b){
    //    cout << a << " " << b <<endl;
    //    int GCD = find_GCD(a, b);
    //    cout << GCD << endl;
    //    cout << find_GCD(a, b) << endl;
    int GCD = find_GCD(a, b);
    int LCM = a*b/GCD;
    cout << GCD << " " << LCM << endl;
  }

}

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

int main(){
	long long int n[50]={0};
	int i=0;
	while(cin>>n[i++]);
	int nn=i-1;
	for(int j=0;j<nn;j+=2){
		long long int gcd=0,lcm=0;
		for(long long int k=1;k<n[j]+n[j+1];k++){
			if(n[j]%k+n[j+1]%k==0)gcd=k;
		}
		long long int a=0,b=0;
		a=n[j]/gcd,b=n[j+1]/gcd;
		cout<<gcd<<" "<<gcd*a*b<<endl;
	}
	return 0;
}