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>

int main()
{
        int a, b, t, GCD;
        while(std::cin >> a >> b)
        {
                t = a, GCD = b;
                while(t != GCD)
                        if(t > GCD)
                                t -= GCD;
                        else
                                GCD -= t;
                std::cout << GCD << " " << (a / GCD)*b << std::endl;
        }
        return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int a,b,GCD,LCM,r,xa,xb;
	while(cin>>a>>b){
		xa=a;xb=b;
		while(xa!=xb){
			if(xa>xb){
			xa = xa%xb;
			}
			else{
			xb = xb%xa;
			}

		}
		
		LCM=(a*b)/xb;
		cout<<xb<<" ";
		cout<<LCM<<endl;
	}

	return 0;

}

C++: // B.cpp

#include <iostream>

using namespace std;

int gcd(int, int);
int lcm(int, int);

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

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a < b){
		max = b, min = a;
	}
	if(min == 0) return max;
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

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

using namespace std;

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

	while (cin >> a >> b){
		int ac, bc;
		ac = a;
		bc = b;
		if (bc > ac) swap(ac, bc);
			while (ac % bc != 0){
				ac %= bc;
			if (bc > ac) swap(ac, bc);
		}
		gcd = bc;
		lcm = a / gcd * b;
	
		cout << gcd << " " << lcm << endl;
		}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
 
int gcd(int a, int b) {
    if(b==0) return a;
    return gcd(b,a%b);
}
 
int main() {
int a,b;
while(cin >> a >> b) cout << gcd(a,b) << " " << a * b / gcd(a,b) << endl;
return 0;
}

C++: //Simultaneous Equation

#include <iostream>
#include <utility>
#include <cstdio>
#include <cassert>

namespace {

template <class T>
T GreatestCommonDivisor(T a, T b)
{
  // a must be less than b
  if (a > b) std::swap(a, b);

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

  return b;
}

template <class T>
T LeastCommonMultiple(T a, T b)
{
  // a must be less than b
  if (a > b) std::swap(a, b);

  T lcm = b;
  while (lcm % a != 0) {
    lcm += b;
  }

  return lcm;
}

} // unnamed namespace

int main()
{
  while (1) {
    long a, b;
    std::cin >> a >> b;
    if (std::cin.fail()) break;

    std::cout
      << GreatestCommonDivisor(a, b) << " "
      << LeastCommonMultiple(a, b) << std::endl;
  }

  return 0;
}

C++: #include<iostream>
#include<utility>
 
int main(){
    unsigned int a, b, tmp, GCD;
    while ( std::cin >> a >> b){
        if( b > a )std::swap( a , b );
        unsigned long int LCM = a;
        GCD = b;
        while(a % GCD != 0){
            tmp = a % GCD;
            a = GCD;
            GCD = tmp;
        }
        LCM = ( LCM / GCD ) * b;
        std::cout << GCD << " " << LCM << std::endl;
    }
    return 0;
}

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		int gcd = 0;
		long long lcm = 0;
		int r = 0;
		int temp_a = 0, temp_b = 0;
		temp_a = a;
		temp_b = b;
		while ((max(temp_a, temp_b) % min(temp_a, temp_b)) != 0){
			r = (max(temp_a, temp_b) % min(temp_a, temp_b));
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = temp_b;
		cout << gcd << " ";

		lcm = a * b / gcd;
		cout << lcm << endl;

	}

	//getchar();

	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int gcd(int,int);
int lcm(int,int);
int tes(int,int);

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

int gcd(int a,int b){
  int n;
  while(a!=b)
    {
      if(a>b)a=a-b;
      else{b=b-a;}
    }
  return a;
}
/*
int tes(int a,int b){
  if(b == 0)return a;
  return tes(b,a%b);
}
*/

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

C++: #include<iostream>
#include<algorithm>
using namespace std;
int gcd(int,int);
int lcm(int,int);
int tes(int,int);

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

int gcd(int a,int b){
  int n;
  n=min(a,b);
  for(int i=n;i>=1;i--){
    if(a%i == 0 && b%i==0)return i;
  }

}

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

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

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

int gcd(int a,int b) {
	int r;
	while (1) {
		if (a > b) {
			r = a%b;
			if (r == 0) {
				break;
			}
			a = b;
			b = r;
			return b;
		}
		if (a < b) {
			r = b%a;
			if (r == 0) {
				break;
			}
			b = a;
			a = r;
			return a;
		}
	}
}

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

C++: #include<stdio.h>

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

int main()
{
	long long a, b,g,l;
	while (scanf("%lld%lld", &a, &b) != EOF)
	{
		g = gcd(a, b);
		l = b / g * a;
		printf("%lld %lld\n", g, l);
	}
	return 0;
}

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

long long gcd(long long x,long long y){
	return (y==0?x:gcd(y,x%y));
}

int main(){
	long long a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF){
		printf("%lld %lld\n",gcd(a,b),a/gcd(a,b)*b);
	}
	return 0;
}

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

long gongyueshu(long a,long b);
int  main()
{
	long  a,b,c,d;
	while(scanf("%d%d",&a,&b)!=EOF)
	{
	

	c=gongyueshu(a,b);
	d=a/c*b;
	
	cout<<c<<" "<<d<<endl;
	return 0;
}
	
	
} 
long gongyueshu(long a,long b)   
{
	if(a%b==0)
  return b;
 return gongyueshu(b,a%b);
}

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

int main(void){
    long long a,b,c,d,x,ans01,ans02;
    int count = 0;
    while(std::cin >> a >> b && count <= 50){
        if(b > a){
           x = a;
           a = b;
           b = x;
        }
        c = a % b;
        d = b % c;
        if(d == 0) {
            ans01 = c;
            ans02 = a * b / c;
        }
        else if (c % d == 0) {
            ans01 = d;
            ans02 = a * b / d;
        }
        std::cout << ans01 << " " << ans02 << std::endl;
        count ++;
    }
    return 0;
}

C++: #include <iostream>
#include <boost/math/common_factor.hpp>
#include <boost/bind.hpp>
using namespace std;
using namespace boost;

int main(){
  int a, b;

  while(cin >> a >> b){
    
    cout<<boost::math::gcd(a, b)<< ' ';
    cout<<boost::math::lcm(a, b)<<std::endl;
    
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

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

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

int main()
{
	solve();
	return(0);
}

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

using namespace std;

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

		cout << a * b / (a / __gcd(a, b)*b) << " " << a / __gcd(a, b)*b << endl;
	}

}

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

int main(){
	long a, b;
	long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << (a / y * b) << endl;
	}
}