Go: package main

import "fmt"

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

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d", G, L)
	}
}

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

C++: /*
*AOJ0005 GCD and LCM
**問題
[http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005&lang=jp]
*/
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

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

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

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

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

C++: #include <iostream>

unsigned int gcd(unsigned int a, unsigned int b) {
	unsigned int r;

	while (b != 0) {
		r = a % b;
		a = b;
		b = r;
	}

	return a;
}

int main() {
	unsigned long int a, b;
	
	while (!std::cin.eof()) {
		std::cin >> a >> b;

		unsigned long long int gcdres = gcd(a, b);
		std::cout << gcdres << " " << (a*b)/gcdres << std::endl;
	}
}

C++: #include <cstdio>

int main() {
    long long int a, b;
    while (~scanf("%lld %lld", &a, &b)) {
        long long int x = a, y = b;
        while (true) {
            x = x % y;
            if (!x) {
                printf("%lld %lld\n", y, a * b / y);
                break;
            }
            y = y % x;
            if (!y) {
                printf("%lld %lld\n", x, a * b / x);
                break;
            }
        }
    }
}

C++: #include<iostream>

int main(){
	int a, b, r;
	
	while(std::cin >> a >> b){
		int product = a*b;
		
		// GCD
		if(a < b){
			int temp = a;
			a = b;
			b = temp;
		}
		while((r = a%b) != 0){
			a = b;
			b = r;
		}
		
		// LCM
		int lcm = product / b;
		
		// show
		std::cout << b << lcm << std::endl;
	}
	
	return 0;
}

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

int main(){
  long a, b;
  long l, m, n;
  while (scanf("%ld %ld", &a, &b) != EOF){
    m = a;
    n = b;

    while (1){
      if (m <= n){
        int t = m;
        m = n;
        n = t;
      }

      if (n == 0){
        cout << m << " " << a * b / m << "\n";
        break;
      }

      l = m % n;
      m = n;
      n = l;

    }

    if (a <= 0 || b <= 0){
      break;
    }
  }

  return 0;
}

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

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

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

template <typename T>
T gcd(T a , T b){
	if (a<b) {
		a^=b;
		b^=a;
		a^=b;
	}
	return a%b ? gcd(a , a%b) : b;
}

int main(){
	int a , b ;
	while(cin>>a>>b){
		printf("%d %d\n" , gcd(a,b) , (a/gcd(a, b)*b));
	}
	return 0;
}

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

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

C++: #include <cstdio>

int dp[30000010];
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(int argc, char const *argv[])
{
	ll x, y;
	while(~scanf("%lld %lld", &x, &y))
	{
		printf("%lld %lld\n", gcd(x, y), lcm(x, y));
	}
	return 0;
}

C++: #include <stdio.h>

int main( void ){
    unsigned float a[20],b[20];
    int nCount;
    for( int i = 0;scanf( "%f %f",&a[i],&b[i] ) != EOF;i++ ) nCount = i;

    for( int k = 0;k < i;k++ ){
        unsigned float buf_a = a[k],buf_b = b[k];

        while( buf_a != buf_b ){
            if( buf_a < buf_b ) buf_a += a[k];
            else                      buf_b += b[k];
        }
        printf( "%d ",( int )buf_a );
        int m,n;
        if( a[k] < b[k] ) m = b[k],n = a[k];
        else if( a[k] > b[k] ) n = b[k],m = a[k];
        else {
            printf( "%d\n",a[k] );
            continue;
        }
        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ) {
                printf( "%d\n",m );
                break;
            }
        }
    }
    return 0;
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
#define ull unsigned long long
ull a, b, ans;

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

ull lcm(ull a, ull b, ull GCD){
	a = a / GCD;
	b = b / GCD;
	return a * b * GCD;
}


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

C++: #include <iostream>

using namespace std;

int main() {
    long long a, b, r, mul;
    while (cin >> a >> b) {
        mul = a * b;
        while ((r = a % b) != 0) {
            a = b;
            b = r;
        }
        cout << b << " " << mul / b << endl;
    }

    return 0;
}

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

#define MAX 256

int main(void){
	
	long max[50], min[50];
	for (long i = 0; i < 50; i++){
		max[i] = 0;
		min[i] = 0;
	}

	long a, b;
	long i = 0;

	while (scanf("%d%d", a, b) != EOF){
		while (max[i] == 0){
			for (long j = 0; j > 0; j--){
				if (a%j == 0 && b%j == 0)max[i] = j;
			}
		}
		long j = 1;
		while (min[i] == 0){
			if ((a*j) % b == 0)min[i] = a*j;
			j++;
		}
		i++;
	}

	for (long j = 0; j < i; j++){
		printf("%d %d\n", max[j], min[j]);
	}

	return 0;
}