Go: package main

import (
	"fmt"
)

func main() {
	var a, b int
	for {
		i, _ := fmt.Scan(&a, &b)
		if i == 0 {
			break
		}

		gcd := getGCD(a, b)
		fmt.Println(gcd, getLCM(a, b, gcd))
	}
}

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

func getLCM(a, b, gcd int) int {
	return a * b / gcd
}

C++: #include<iostream>
using namespace std;
int main(){
  int sn = 0;
  int bn = 0;
  int p,mem,d1,d2,f,lcm,gcd;
  int count = 0;
  while(cin>>sn>>bn){
  if(sn>bn){
    mem = bn;
    bn = sn;
    sn = mem;
  }
  p = bn * sn;
  for(int i=bn;i<=p;i++){
    if(i%sn==0&&i%bn==0) lcm = i;
    break;
  }
  for(int i=sn;i>=1;i--){
    if(sn%i==0&&bn%i==0) gcd = i;
    break;
  }
  /*d1 = lcm;
  while(d1==0){
    d1 = d1 / 10;
    count++;
  } 
  d1 = count;
  count = 0;
  d2 = gcd;
  while(d2==0){
    d2 = d2 /10;
    count++;
  }
  d2 = count;
  f = d1 - 2;*/
  cout << gcd << ' '<< lcm <<endl;
  /*cout << "最大公倍数は　"　<< gcd << ' ' <<　"です。" << endl;
  cout << "最大公約数は"　<< lcm;  
  for(i=0;i<f;i++) cout << ' ';
  cout << "です。"　<< endl;*/
  }
  return 0;
}

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

long long gcd(long long a, long long b){
    long long x,r;
    if(a < b){
      x = a;
      a = b;
      b = x;
      }
    for(x = 0; b != 0; x++){
      r = a%b;
      a = b;
      b = r;
    }
    return a;
}
int main(void){
    long long a, b;

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

    return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int d(int n,int m)
{
    int t;
    while(m!=0)
    {
        if(n<m) {t=n;n=m;m=t;}
        t=m;
        m=n%m;
        n=t;
    }
    return n;
}
int main()
{
    int t,n,m;
    while(1)
    {
        cin>>n>>m;
        t=d(n,m);
        cout<<t<<" "<<n*(m/t)<<endl;
    }
    return 0;
}

C++: #pragma  warning (disable:4996)
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int gcd(int d, int x){
	if (x == 0) return d;
	else return gcd(x, d%x);
}
long long lcm(int a, int b){
	int g = gcd(a, b);
	return a / g*b;
}
int main(){
	int n, m;
	while (cin >> n >> m){
		int s = n + m;
		n = max(n, m);
		m = s - n;
		cout << gcd(n, m) << " " << lcm(n, m) << endl;
	}return 0;
}

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

long long a,b;

long long gcd(long long x,long long y){
  if(y == 0) 
    return x;
  else 
    return gcd(y, x % y);
}
long long lcm(long long x,long long y){
    return (x * y) / gcd(x, y);
}

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

C++: #define scanf_s scanf
#include <stdio.h>
#include <iostream>
using namespace std;
#define MAX 200
int main(void)
{
	long long int a, b, c, x, y;
	while (scanf_s("%lld %lld", &a, &b) != EOF) {
		if (b > a) { x = a; a = b; b = x; }
		x = a; y = b;
		c = a % b;
		while (c != 0) {
			a = b; b = c;
			c = a % b;
		}
		printf("%lld %lld\n", b, x * y / b);
	}
}

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

int main(){
	long a, b, _a, _b, r;
	while( cin >> a >> b)
	{
		if( a < b ) swap(a, b);
		_a = a; _b = b;
		while( ( r = _a % _b ) != 0 ){
			_a = _b;
			_b = r;
		}
		cout << _b << " " << (a / _b) * b << "\n";
	}
	return 0;
}

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

int main(){
  int a,b,t,k;

  for(int n=0;n<50;n++){
    cin>>a;
    cin>>b;
    t=1;
    for(int i=1;i<2000000;i++){
      if(a%i==0&&b%i==0){
        a=a/i;
        b=b/i;
        t=i*t;
      }
    }
    k=t*a*b;
    cout<<t<<" "<<k;
  }
  return 0;
}

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

long gcd(long a, long b){
    if(a < b){
        swap(a, b);
    }else{
        while(b > 0){
            int r = a % b;
            a = b;
            b = r;
        }
    }
    return a;
}

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

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

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

int main(){
	int a,b;
	int i=1;
	int j=1;
	cin>>a>>b;
		while(1){
		if(a%i!=0){
			i++;
			continue;
		}
		if(b%j!=0){
			j++;
			continue;
		}
		if(a/i<b/j){
			j++;
		}
		if(a/i>b/j){
			i++;
		}
		if(a/i==b/j){
		cout<<a/i<<" ";
		break;
		}
	}
	
	i=1;
	j=1;
	while(1){
	if(a*i<b*j){
		i++;
	}
	if(a*i>b*j){
		j++;
	}
	if(a*i==b*j){
		cout<<a*i<<endl;
		break;
	}
	}
return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){

  long long a;
  long long b;
  long long result;
  long long temp1;
  long long temp2;

  while( cin >> a >> b ){

    temp1 = a;
    temp2 = b;

    while(1){
      result = a % b;
      if( result == 0 )break;
      else a = b;  b = result;
    }
    cout << b << " " << temp1 / b * temp2 << endl;
  }
  return 0;
}

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

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

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

C++: #include<bits/stdc++.h>
using namespace std;
int n,m;
int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
int main()
{
    while(cin>>n>>m){
        int d=gcd(n,m);
        int lcm=n/d*m;
        cout<<d<<" "<<lcm<<endl;
    }
    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>
#include <vector>
#include <math.h>
#include <string>

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 (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;
	}
	while (1);
	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<stdio.h>

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

int main(){
	int a,b,gcd,mem;
	long long lcm;
	while(scanf("%d %d",&a,&b)!=EOF){
		if(a>b){
			mem=b;
			b=a;
			a=mem;
		}
		gcd=fun(b,a);
		lcm=a/gcd*b;
		printf("%d %lld\n",gcd,lcm);
	}

}

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

int gcm_sub(int c,int d)
	{
		if (c % d == 0)
			return d;
		else
			return gcm_sub(d,c % d);
	}
int gcm(int a,int b)
{
	if (a >= b) 
		return gcm_sub(a,b);
	else if (b > a)
		return gcm_sub(b,a);
}

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

int main()
{
	int a[2];
	int i=0;
	int n1,n2;
	while(cin >> n1 && cin >> n2){
		// cout << sizeof(a) / sizeof(a[0]) << endl;
		cout << gcm(n1,n2) << ' ' << lcm(n1,n2) << endl;
	}
	
	return 0;
}