Go: package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for sc.Scan() {
		var a, b int
		fmt.Sscanf(sc.Text(), "%d %d", &a, &b)
		gcd := gcd(a, b)
		fmt.Printf("%d %d\n", gcd, (a/gcd)*b )
	}
}

func gcd(a int, b int) (gcd int) {
	var i, j, k int
	if a > b {
		i = a
		j = b
	} else {
		i = b
		j = a
	}

	k = i % j

	for k > 0 {
		num := i
		i = j
		j = num % i
		k = i % j
	}

	return j
}

C++: #include <stdio.h>
int gcd(long long int x,long long int y)
{
    long long int tem;
    while(y!=0)
    {
        tem=y;
        y=x%y;
        x=tem;
    }
    return x;
}
int main()
{
    long long int a,b,x,y,l,g;
    while(scanf("%lld%lld",&a,&b)==2)
    {
        g=gcd(a,b);
        l=(a*b)/g;
        printf("%lld %lld\n",g,l);
    }
    return 0;
}

C++: /*
 0005-GCD_and_LCM.cpp
 
 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005
 */

#include<iostream>
#include<algorithm>

using namespace std;

int main(){
    int a,b;
    while(cin>>a>>b){
        long int temp_a = a;
        long int temp_b = b;
        while(1){
            long int l = max(temp_a,temp_b);
            long int r = min(temp_a,temp_b);
            l = l-r;
            if(l==r){
                cout<<l<<" "<<a/l * b/l * l <<endl;
                break;
            }else{
                temp_a = l;
                temp_b = r;
            }
        }
    }
}

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


long long int GCM(long long int a,int long long b){
	while(a!=b){
		a>b? a-=b:b-=a;
	}
	return a;
}

int main()
{
	ifstream ifs("Text.txt");
	long long int a,b,L,G;
	
	
	ifs>>a;
	do{
	ifs>>b;
	G=GCM(a,b);
	L=a*b/G;
	cout<<G<<" "<<L<<endl;
	}while(ifs>>a);
	cin>>a;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
#define int long long

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

unsigned main(){
    int A,B;
	while(cin>>A>>B){
		printf("%lld %lld\n",gcd(A,B),A*B/gcd(A,B));
	}
    return 0;
}

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


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

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

long long GCD(unsigned long long a,unsigned long long b){
	if(b==0)return a;
	unsigned long long alt=a%b;
	GCD(b,alt);
}

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

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

long int GCD(long int a, long int b){
  if(a < b){long int c = a; a = b; b = c;}
  while(true){
    long int c = a % b;
    if(c == 0) return b;
    a = b;
    b = c;
  }
  return 0;
}

long int LCM(long int a, long int b){
  return a * b / GCD(a, b);
}

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

C++: #include<iostream>

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

C++: #include "iostream"
#include "iomanip"
using namespace std;
int main()
{
	long m, n, a, b, t, c;
	while(cin>>a>>b)
	{
		m=a;   n=b;  
		while(b!=0)  
		{
			c=a%b;
			a=b;
			b=c;
		}
		cout<<a<<' '<<(m/a)*n<<endl;
	}
}

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

long int a,b;

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

int main(){
    while(cin){
        cin >> a >> b;
        if(!cin) break;
        long int ans = gcd(a,b);
        cout << ans << " " << (a*b)/ans << endl;
    }
}

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

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

int main(void){
    int a, b, tmp;
    if (a < b){
        tmp = b;
b = a;
a = tmp;

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

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

u_int euclid_alg(const u_int a, const u_int b) {
	return a > b ? a % b : b % a;
}

int main(void) {
	u_int a,b;
	std::vector<u_int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}

	for(int i = 0; i < (int)num.size(); i+=2){
		u_int pro = num[i] * num[i+1];
		while(num[i] != 0 && num[i+1] != 0){
		if(num[i] > num[i+1]){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}

		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < (int)num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}

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

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

int main()
{
  unsigned int a, b;


  while (cin >> a >> b)
  {
    if (a < b)
    {
      int t = a;
      a = b;
      b = t;
    }

    int g = gcd(a,b);
    int l = a * (b / g);

    cout << g << ' ' << l << endl;
  }
  return 0;
}

C++: #include <iostream>
 
using namespace std;
 
int GCD(int a, int b)
{
    if(a % b == 0) { return b; }
 
    if(b % a == 0) { return a; }
 
    if(a > b) { return GCD(a % b, b); }
 
    if(a < b) { return GCD(a, b % a); }
}
 
 
int main()
{
    int a, b;
 
    while(cin >> a >> b)
    {
int n=GCD(a,b);
        cout << n << ' ' << a*b/n << endl;
    }
 
    return 0;
}

C++: #include <stdio.h>

int main(){
 
    int buf1[50],buf2[50];
 
    int k = 0;
    while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++;
 
    for( int i = 0;i < k;i++ ){
        int b1 = buf1[i],b2 = buf2[i];
        int m,n;
        if( b1< b2 ){
            m = b2,n = b1;
        } else if( b1 > b2 ){
            m =  b1,n = b2;
        } else printf( "%d ",b2 );
 
        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ){
                printf( "%d\n",m );
                break;
        }
        while( b1 != b2 ){
            if( b1 < b2 ) b1 += buf1[i];
            else             b2 += buf2[i];
        }
        printf( "%d\n",b1 );
    }
    return 0;
}

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

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

    int max = max(a, b);
    int min = min(a, b);

    long gcd = 0, lcm = 0;

    for(int i = 0; i < min; i++){
        if(max % i == 0) 
          gcd = i;
    }
    
    int j = 1;

    while(1){
      if((max * j) % min == 0){ 
        lcm = max * j;
        break;
      }
      else{ 
        i++;
      }
    }
    
    cout << gcd << " " << lcm << endl;
  }
}

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

int main() {
	long long a,b;
	while (cin >> a >> b) {
		long long gcd,lcm;
		// ??????????????????????????????
		long q = max (a,b);
		long r = min (a,b);
		for (;;) {
			if (r == 0) break;
			long new_r;
			new_r = q % r;
			q = r;
			r = new_r;
		}
		gcd = q;
		lcm = a * b / gcd;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

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

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