Go: package main

import "fmt"

func main() {
	var a, b int
	var gcd, lcm int

	for {
		_, err := fmt.Scanf("%d %d", &a, &b)
		if err != nil {
			return
		}

		var big, small int
		// GCD
		if a > b {
			big = a
			small = b
		} else {
			big = b
			small = a
		}

		for {
			if big%small == 0 {
				gcd = small
				break
			} else {
				small, big = big%small, small
			}
		}

		// LCM
		lcm = a * b / gcd

		fmt.Println(gcd, lcm)
	}
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	unsigned long long a,b,c,d,e,f,maxx=0,data,minn=0,o;
	while (scanf("%llu %llu",&a,&b)!=-1){
		data=max(a,b);
		while(maxx==0){
			if (a%data==0 && b%data==0) maxx=data;
			data-=1;
		}
		minn=a*b/maxx;
		cout<<maxx<<" "<<minn<<endl;
		maxx=0;
		minn=0;
	}
	return 0;
}

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

int gcd(int u, int v)
{
  int r, z;

    if(v > u)
    {
      z = u;
      u = v;
      v = z;
    }

  while((r = u%v) != 0)
  {
    u = v;
    v = r;
  }    
  return v;  
}


int main(void)
{
  int a, b, lcm;

  while(scanf("%d %d", &a, &b))
  {      
    lcm = b/gcd(a,b)*a;
    printf("%d %d\n", gcd(a,b), lcm);
  }

  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++: #include <iostream>
#include <iomanip>

int gcd(int x, int y)
{
    if(x < y){
        std::swap(x, y);
    }
    while(y > 0){
        int r = x % y;
        x = y;
        y = r;
    }
    return x;
}
int lcm(int x, int y)
{
    int a = x;
    int b = y;
    while(a != b){
        if(a < b){
            a += x;
        }else{
            b += y;
        }
    }
    return a;
}
int main()
{
    while(true){
        int a, b;
        std::cin >> a >> b;
        if(std::cin.eof()) break;
        std::cout << gcd(a, b) << " " << lcm(a, b) << std::endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
for(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;
cout<<y<<" "<<L<<endl;
}
  return 0;
}

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

int main() {
	int a, b, c, d, e, f, g, l;
	cin >> a >> b;
	c = a; d = b;
	e = a; f = b;
	while (1) {
		if (a>b) {
			a %= b;
			if (a == 0) { g = b; break; }
		}
		else if (a<b) {
			b %= a;
			if (b == 0) { g = a; break; }
		}
	}
	while (1) {
		if (c>d) d += f;
		else if (c < d) c += e;
		if (c == d) {l = c; break;}
	}
	cout << g << " " << l << endl;
}

C++: #include<iostream>
using namespace std;
int gcd(int a,int b) {
  if(a<b) {
    int tmp=a;
    a=b;
    b=tmp;
  }
  if(a%b==0) return b;
  return gcd(b,a%b);
}

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

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

int main() {

  long long int a,b;

  while( cin >> a >> b ) {

    long long int c,d;
    if ( a < b ) {
      c = b;
      d = a;
    }else {
      c = a;
      d = b;
    }

    while(true) {

      if ( c % d == 0 ) {
	break;
      }
      long long int k = c%d;
      c = d;
      d = k;

    }

    cout << d << " " << a/d*b << endl;

  }

  return 0;

}

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

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

int main(){
int a;
int b;
int c;
int d;
int e;
int f;
while(cin>>d>>e){
a=d;
b=e;
while(1){
c=a%b;
a=b;
b=c;
if(b==0){break;}
}
f=d/a*e;
cout << a <<" ";
cout << f <<endl;}}

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

int main(void)
{

	long a,b,ax,bx;

	while(scanf("%d %d", &a,&b) != EOF){

	if(a < b)
		swap(a,b);

	ax = a,bx = b;


	long c;
	while(ax % bx != 0){
		c = bx;
		bx = ax%bx;
		ax = c;
	}

	int ans;

	if(a % b == 0)
		ans = a;
	else
		ans = (a/bx)*(b/bx)*bx;

	cout << bx << ' ' << ans << endl;

	}

	return 0;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

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

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	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;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD (int) (1e9+7)
#define INF (int) 2e9

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

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

int gcd(int a, int b) {
  	int q,r;
	while(r==0){
	q=a/b;
	r=a%b;
	b=r;
	a=b;
	}
	return b;
}

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

C++: #include<iostream>
using namespace std;
int gcd(int a,int b) {
  if(a<b) {
    int tmp=a;
    a=b;
    b=tmp;
  }
  if(a%b==0) return b;
  return gcd(b,a%b);
}

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

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

int main(){
int i = 0;int a = 0;int b = 0;int aa = 0;int bb = 0;
while(!cin.eof()){
cin >> a >> b;
if(a >= b){
aa = b;bb = a;
}
else{
aa = a;bb = b;
}
while(aa != 1){
int c = 0;
bb = bb % aa;
c = aa;
aa = bb;
bb = c;
}
cout << bb << " " << a * b / bb << endl;

}
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int *a, *b, p, q, i;
	a = &p;
	b = &q;
	while(cin >> p >> q){
		for(i = (*a > *b)? *b : *a; i >= 1; i--){
			if(*b%i == 0 && *a%i == 0){
				cout << i << " ";
				break;
			}
		}
		cout << ((*a)/i*(*b)) << endl;
	}
	
	return 0;
}

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

int main()
{
    unsigned long long a, b;

    while( cin >> a >> b )
    {
       for( int i = a; i > 0; i-- ) 
        {
                if( a % i == 0 && b % i == 0 ) 
                {
                    cout << i << " " << a * b / i << endl;
                    break;
                }
        }
    }
    return 0;
}

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


typedef long long ll;

ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}


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


int main(){
    while(true){
        ll a,b;
        cin >> a >> b;
        
        if(cin.eof()){
            break;
        }

        cout << gcd(a,b) << " " << lcm(a,b) << endl;
    }
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int i;
int js(int x,int y)
{
    for(i=1; ;i++)
    {
        if(i%x==0&&i%y==0)
        {
            break;
        }
    }
    return i;
}
main()
{
    int n,k,j,max,min,x,y,t;
    while(~scanf("%d %d",&x,&y))
    {
        max=js(x,y);
        if(x>y)
            {
                t=x;
                x=y;
                y=t;
            }
        while(x!=0)
        {
            t=x;
            x=y%x;
            y=t;

        }
        min=y;
    printf("%d %d\n",min,max);
    }

}