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<algorithm>
using namespace std;
int main() {
	long a, b;
	int 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>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
int main()
{
    int a,b;
    while (cin >> a >> b)
    {
        cout << __gcd(a,b) << " " << (long long)a*b/__gcd(a,b) << endl;
    }
}

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

int gcd( unsigned int, unsigned int );
int main(void)
{
	unsigned int a, b, g, l;

	while( std::cin >> a >> b ){
		g = gcd( a, b );
		l = a * b / g;
		std::cout << g << std::endl;
		std::cout << l << std::endl;
	}

	return 0;
}

int gcd( unsigned int a, unsigned int b ){
	int n, i;
	unsigned int tmp[3];

	tmp[0] = std::max( a, b );
	tmp[1] = std::min( a, b );

	for( n = 0;; n++ ){
		for( i = 1;; i++ ){
			tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i;
			if( tmp[( n + 2 ) % 3 ] < tmp[( n + 1 ) % 3 ] ){
				break;
			}else if( tmp[ n % 3 ] * tmp[( n + 1 ) % 3 ] * tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[0] + tmp[1] + tmp[2] - std::max( tmp[0], std::max( tmp[1], tmp[2] ));  
			}

			std::cout << "tmp[ n % 3 ] = " << tmp[ n % 3 ] << std::endl;
			std::cout << "tmp[( n + 1 ) % 3 ] = " << tmp[( n + 1 ) % 3 ] << std::endl;
			std::cout << "tmp[( n + 2 ) % 3 ] = " << tmp[( n + 2 ) % 3 ] << std::endl;
		}
	}

	return -1;
}

C++: #include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <algorithm>
#include <stack>

using namespace std;

int gcd(int m,int n){
	if(m == 0 || n == 0){
		return 0;
	}
	while(m != n){
		if(m > n){
			m -= n;
		}
		else{
			n -= m;
		}
	}
	return m;
}

int icm(int m,int n){
	if(m == 0 || n == 0){
		return 0;
	}
	return ((m / gcd(m,n)) * n);
}

int main(){
	int m = 0,n = 0;
	int resGcd = 0,resIcm = 0;
	while(cin >> m >> n){
		resGcd = gcd(m,n);
		resIcm = icm(m,n);
		cout << resGcd << " " << resIcm << endl;
	}
	return 0;
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  for (Integer a, b; cin >> a >> b, cin; ) {
    int x = max(a,b);
    int y = min(a,b);
    while (y > 1) {
      x %= y;
      int t = x;
      x = y;
      y = t;
    }
    cout << x << ' ' << (a / x * b) << endl;

  }

  return 0;
}

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

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

void solve(int a, int b){
  if(a < b)
    swap(a, b);
  int gcd = GCD(a, b);
  cout << gcd << " " << a / gcd * b << endl;
}

int main(){
  int a, b;
  while(cin >> a >> b){
    solve(a, b);
  }
}

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

using namespace std;

int gcd(int h,int l){
  if(h<l){
    swap(h,l);
  }
  while(h%l){
    h%=l;
    swap(h,l);
  }
  return l;
}

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

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

int gcd(int a, int b){
  //a < b ユークリッドの互除法
  if(a==0) return b;
  return gcd(b%a,a);
}

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

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++: #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;}
}
cout << a <<" ";
f=(d*e)/a;
cout << f <<endl;}}

C++: #include<iostream>

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

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

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	long long a,b,c,a1,b1,p,min,max;
	while(cin>>a>>b)
	{
		if(a<b){p=a;a=b;b=p;}
		a1=a;b1=b;
		while(a%b!=0)
		{
           c=a%b;
           a=b;
           b=c;
       }
		min=b;
		max=a1*b1/min;
		cout<<min<<" "<<max<<endl;
	}
	return 0;
}

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

//最大公約数
int gcd(int a, int b)
{
    int r;
    while((r = a % b) != 0) 
    {
        a = b;
        b = r;
    }
    return b;
}


//最小公倍数
int lcm(int a, int b)
{
    return ((a / gcd(a,b))*b);
}



int main(){

int a,b;

while(cin >> a >> b){
    if(a == -1 or b == -1)  break;
   while(a <= 0 or a>2000000000 or b <= 0 or b > 2000000000){
       cin >> a >> b;
   }
   if(a > 0 and b > 0){
        cout << gcd(a,b) << " "<< lcm(a,b)<< "\n";
    }
}

return 0;
}

C++: #include <stdio.h>
int main(void){
    long a, b, c, d, tmp;
        scanf("%d %d", &a, &b);
     d = a * b;
    if(a < b) {
        tmp = a;
        a = b;
        b = tmp;
    }
     c = a % b;
    while(c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
        printf("%d %d\n", b, d / b);
            return 0;
}

C++: #include<iostream>

using namespace std;

int GCD(int c, int d)
{
    int m;
    
    while(d != 0)
    {
        m = c % d;
        c = d;
        d = m;
    }
    
    return c;
}

int LCM(int c, int d)
{
    int lcmValue;
    lcmValue = (c / GCD(c, d)) * d;  //  not %
    
    return lcmValue;
}
  
int main()
{  
    int a, b;
    
    while(cin>>a>>b)
    {
        cout<<GCD(a, b)<<" "<<LCM(a, b)<<endl; 
    }
    
    return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
long koyaku(long a,long b);

int main(){
	long c,d,e;
	unsigned long f;
	while(cin>>c>>d){
		e=koyaku(c,d);
		f=c/e*d;
		cout<<e<<" "<<f<<endl;
	}
	return 0;
}

long koyaku(long a,long b){
	long n=max(a,b);
	long nb=n/2;
	long ans=1;
	for(long i=2;i<=nb;i++){
		if(a%i==0&&b%i==0)ans=i;
	}
	if(a%n==0&&b%n==0)ans=n;
	return ans;
}

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 {
    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; 
}