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 <iostream>
using namespace std;
int main() {
    int a;
    int b;
    while(cin>>a>>b){
        int c=a*b;
    while(a%b!=0&&b%a!=0){
        if(a>b){
            a=a%b;
        }
        else if(b>a){
            b=b%a;
        }
    }
    if(a>b) cout<<b<<" "<<c/b;
        else cout<<a<<" "<<c/a;
        
    }
    return 0;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b),swap(ta,tb);
	while(1){
	
		int tmp=b;
		b=a%b;
		a=tmp;
		cout<<a<<b<<endl;
		if(b==0)break;
	}
	cout<<a<<" "<<ta*tb/a<<endl;
	}
	return 0;
}

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

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

int main()
{
	while(true){
		int a,b;
		cin>>a>>b;
		
		if(cin.eof())
			break;
			
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

int main()
{
//	cut here before submit 
//	freopen ("testcase.GCD_and_LCM", "r", stdin );
	string str = "";
	while (getline (cin, str ) ){
		stringstream ss (str );
		int a, b;
		ss >> a >> b;
		int g = gcd (a, b );
		int l = a/g;
		l *= b;
		printf ("%d %d\n", g, l );
	} // end loop
		
	return 0;
}

C++: //↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑

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

long long lcm(long long a, long long b) {
	long long  g = gcd(a, b);
	return a / g * b;
}

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

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

int gcd(int a,int b){
    int c;
    if(a<b){
        a+=b;
        b=a-b;
        a-=b;
    }
    while(b!=0){
        c=a%b;
        a=b;
        b=c;
    }
    return a;
}
 
int main(){
    int data0,data1;
    int answer;
    while(cin>>data0>>data1){
        answer=gcd(data0,data1);
        cout<<answer<<" "<<data0/answer*data1<<endl;
    }
}

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

int gcd(int a, int b)
{
    int i;
    if (b > a){
        int j = a;
        a = b;
        b = j;
    }
	for (i = a; i*i >= a; i--){
		if (a % i == 0)
			if( b % i == 0)
				return i;
	}
}


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<iostream>
using namespace std;
int main(){
  int sn = 0;
  int bn = 0;
  int p,mem,d1,d2,f,lcm,gcd;
  int count = 0;
  while(cin>>sn>>bn){
  if(sn>bn){
    mem = bn;
    bn = sn;
    sn = mem;
  }
  p = bn * sn;
  for(int i=bn;i<=p;i++){
    if(i%sn==0&&i%bn==0) lcm = i;
    break;
  }
  for(int i=sn;i>=1;i--){
    if(sn%i==0&&bn%i==0) gcd = i;
    break;
  }
  /*d1 = lcm;
  while(d1==0){
    d1 = d1 / 10;
    count++;
  } 
  d1 = count;
  count = 0;
  d2 = gcd;
  while(d2==0){
    d2 = d2 /10;
    count++;
  }
  d2 = count;
  f = d1 - 2;*/
  cout << gcd << ' '<< lcm <<endl;
  /*cout << "最大公倍数は　"　<< gcd << ' ' <<　"です。" << endl;
  cout << "最大公約数は"　<< lcm;  
  for(i=0;i<f;i++) cout << ' ';
  cout << "です。"　<< endl;*/
  }
  return 0;
}

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

long long gcd(long long a, long long b){
    long long x,r;
    if(a < b){
      x = a;
      a = b;
      b = x;
      }
    for(x = 0; b != 0; x++){
      r = a%b;
      a = b;
      b = r;
    }
    return a;
}
int main(void){
    long long a, b;

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

    return 0;
}

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;
        t=d(n,m);
        cout<<t<<" "<<n*(m/t)<<endl;
    }
    return 0;
}

C++: #pragma  warning (disable:4996)
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int gcd(int d, int x){
	if (x == 0) return d;
	else return gcd(x, d%x);
}
long long lcm(int a, int b){
	int g = gcd(a, b);
	return a / g*b;
}
int main(){
	int n, m;
	while (cin >> n >> m){
		int s = n + m;
		n = max(n, m);
		m = s - n;
		cout << gcd(n, m) << " " << lcm(n, m) << endl;
	}return 0;
}

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

long long a,b;

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

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

C++: #define scanf_s scanf
#include <stdio.h>
#include <iostream>
using namespace std;
#define MAX 200
int main(void)
{
	long long int a, b, c, x, y;
	while (scanf_s("%lld %lld", &a, &b) != EOF) {
		if (b > a) { x = a; a = b; b = x; }
		x = a; y = b;
		c = a % b;
		while (c != 0) {
			a = b; b = c;
			c = a % b;
		}
		printf("%lld %lld\n", b, x * y / b);
	}
}

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

int main(){
	long a, b, _a, _b, r;
	while( cin >> a >> b)
	{
		if( a < b ) swap(a, b);
		_a = a; _b = b;
		while( ( r = _a % _b ) != 0 ){
			_a = _b;
			_b = r;
		}
		cout << _b << " " << (a / _b) * b << "\n";
	}
	return 0;
}

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

int main(){
  int a,b,t,k;

  for(int n=0;n<50;n++){
    cin>>a;
    cin>>b;
    t=1;
    for(int i=1;i<2000000;i++){
      if(a%i==0&&b%i==0){
        a=a/i;
        b=b/i;
        t=i*t;
      }
    }
    k=t*a*b;
    cout<<t<<" "<<k;
  }
  return 0;
}