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 <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long ll;

template<class T>
T gcd(T a,T b){
	while(a % b != 0){
		T buf = b;
		b = a%b;
		a = buf;
	}
	return b;
}

int main(){
	ll a,b;
	while(cin>>a>>b){
		ll g = gcd(a,b);
		ll l = a / g * b;

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

C++: #include<iostream>

using namespace std;

int main()
{
	
	int a, b;
	int temp;
	int big, small;
	
	while(cin>>a>>b){
		
		if(a < b){
			big = b;
			small = a;
		}
		else{
			big = a;
			small = b;
		}
		
		for(;;){
			temp = big % small;
			if(temp == 0){
				break;
			}
			if(temp > small){
				big = temp;
			}
			else{
				big = small;
				small = temp;
			}
		}
		cout << small <<" "<< a/small*b << endl;
	}
}

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

using namespace std;

void swap(long *a, long *b){
	long tmp= *a;
	*a = *b;
	*b = tmp;
}

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

long lcm(long x, long y){
	return (x*y/gcd(x,y));
}

int main(){
	long a, b;
	while( scanf(" %ld %ld", &a, &b) != EOF ){
		printf("%ld %ld\n", gcd(a,b), lcm(a,b));		
	}

	return 0;
}

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

int gcd(int a,int b){

    if(b==0) return a;

    return gcd(b,a%b);
}

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

        if(cin.eof()) break;

        int g =gcd(a,b);
        cout<<g<<' '<<a/g*b<<endl;
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

// プロトタイプ宣言
int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i<j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	
	if(j == 0){
		return i;
	}else{
		return gcd(j, i%j);
	}
	
}

C++: #define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

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

C++: #include<iostream>
#include<stdio.h>
using namespace std;
typedef __int64 ll;
ll gcd(ll a,ll b){
    return (b==0)?a:gcd(b,a%b);
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}
int main(){
    ll a,b;
    while(scanf("%I64d %I64d",&a,&b)!=EOF){
        cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
    }
    return 0;
}

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

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

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

// int64_t gcd(int64_t a, int64_t b) {
//   if (a == 0 || b == 0) return a + b;
//   return (a < b ? gcd(a, b - a) : gcd(b, a - b));
// }
// 
// int64_t lcm(int64_t a, int64_t b) {
//   return a / gcd(a, b) * b;
// }

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

C++: #include <iostream>

using namespace std;

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

	while (cin >> a >> b){
		if (b > a){
			c = a; 
			a = b; 
			b = c;
		}

		lcm = a * b;
		while (1){
			r = a % b;

			if (r == 0){
				break;
			}

			gcd = r;
			a = b;
			b = r;
		}

		lcm /= gcd;
		cout << gcd << " " << lcm << endl;
	}

	return 0;
}

C++: #include <stdio.h>

int main(){
	int a,b,gcd,lcm,status;
	while(1){
		status=scanf("%d%d",&a,&b);
		if (status==EOF) break;
		gcd=a;
		while(gcd%b!=0){
				gcd+=a;
		}
		
		lcm=a*b/gcd;
		

		printf ("%d %d\n",lcm,gcd);
	}
	return 0;
}

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

int main() {
	int a, b;
	int LCM = 0;	//最小公倍数
	int GCD = 0;	//最大公約数
	while (cin >> a >> b) {
		if (a < b) {
			int temp = a;
			a = b;
			b = temp;
		}
		LCM = a * b;
		while (a%b != 0) {
			int r = a % b;
			a = b;
			b = r;
		}
		GCD = b;
		LCM /= GCD;
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

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

using namespace std;

int getGcd(int x, int y){
	int r;
	while( (r=x%y) != 0 ){
		x=y;
		y=r;
	}
	return y;
}

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

C++: #include <iostream>
#include<sstream>
#include <string>
int gcd( int m, int n )
{
	// ?????°?????????????????´??????????????????
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ???????????????????????????
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// ?????°?????????????????´??????????????????
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int main() {
  std::string s;
  int a{},b{};
  
  while (std::getline(std::cin, s)) {
    std::stringstream ss;
    ss<<s;
    ss>>a>>b;
    std::cout<<gcd(a,b)<<' '<<lcm(a,b)<<std::endl;
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <math.h>

int main(void);
unsigned int gcd(unsigned int x, unsigned int y);
unsigned int lcm(unsigned int x, unsigned int y);

int main(){
	int dataset_count = 0;
	unsigned int first_num = 0;
	unsigned int second_num = 0;

	std::vector<unsigned int> first_num_vector;
	std::vector<unsigned int> second_num_vector;

	//while (dataset_count < 2){
		//std::cin >> first_num >> second_num;
	while ((std::cin >> first_num >> second_num) || (dataset_count < 50)){
		dataset_count++;
		first_num_vector.push_back(first_num);
		second_num_vector.push_back(second_num);
	}
	for (unsigned int i = 0; i < first_num_vector.size(); i++){
		std::cout << gcd(first_num_vector[i], second_num_vector[i]) << " " << lcm(first_num_vector[i], second_num_vector[i]) << std::endl;
	}
	return 0;
}


// 最大公約数を求める関数
unsigned int gcd(unsigned int x, unsigned int y)
{
	unsigned int r;

	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	// ユーグリッドの互除法
	while ((r = x % y) != 0) // yで割り切れるまでループ
	{
		x = y;
		y = r;
	}
	return y;
}

//	最小公倍数を求める関数
unsigned int lcm(unsigned int x, unsigned int y)
{
	unsigned int rtn;

	if (x == 0 || y == 0)  // 引数チェック
	{
		return 0;
	}

	rtn = (x / gcd(x, y)) * (y / gcd(x, y));

	return rtn * gcd(x, y);
}

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

u_int getGCD(u_int m, u_int n){
  u_int temp;
  if(m < n)
    std::swap(m,n);
  while(n != 0){
    temp = m % n;
    m = n;
    n = temp;
  }
  return m;
}

inline u_int getLCM(u_int m, u_int n, u_int gcd){
  return m * (n / gcd);
}

int main(){
  u_int a, b, gcd;
  while(std::cin >> a >> b){
    gcd = getGCD(a, b);
    std::cout << gcd << " " << getLCM(a, b, gcd) << std::endl;
  }
  return 0;
}

C++: #include "iostream"
using namespace std;

int main()
{
	int a,b,k,GCD,LCM;   //GCD譛?、ァ蜈ャ郤ヲ謨ー  LCM譛?ー丞?蛟肴焚
	while(cin>>a>>b)
	{
		GCD=1;
		k=1;
		while(k<=a&&k<=b)
		{
			if(a%k==0&&b%k==0)
			{
				GCD=k;
			}
			k++;
		}
		LCM=(a/GCD)*b;
		cout<<GCD<<" "<<LCM<<endl;
	}
	return 0;
}