Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

C++: #include<cstdio>
#include<cstring>
#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<sstream>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<utility>
#include<sstream>
#define mem0(x) memset(x,0,sizeof x)
#define mem1(x) memset(x,-1,sizeof x)
#define dbug cout<<"here"<<endl;
//#define LOCAL

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e6+10;
const int MOD = 1000000007;

ull n,m;

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

int main(){
    #ifdef LOCAL
        freopen("C:\\Users\\asus-z\\Desktop\\input.txt","r",stdin);
        freopen("C:\\Users\\asus-z\\Desktop\\output.txt","w",stdout);
    #endif
    while(cin >> n >> m){
        ull tmp = gcd(n, m);
        cout << tmp << " " << n*m/tmp << endl;
    }
    return 0;
}

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

int gcd(long num1,long num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(long num1,long num2) {
	return num1 * num2 / (double)gcd(num1, num2);
}

int main() {
	long a, b;
	while (~scanf("%d %d",&a,&b)) {
		printf("%d %d\n", gcd(a, b),(long)lcm(a,b));
	}
}

C++: #include <iostream>
using namespace std;
long GCDr(long m, long n) {
	int r;
	if (m < n) {
		swap(m, n);
	}
	while (n > 0) {
		r = m % n;
		m = n;
		n = r;
	}
	return m;
}
int main() {
	long long a, b;
	while (cin >> a >> b) {
		long long GCD, LCM;
		if (a == b) {
			//a=b??????????????????
			GCD = a;
			LCM = a;
		}
		else {
			GCD = GCDr(a, b);
		}
		LCM = a * b / GCD;
		cout << GCD << " " << LCM << endl;
	}
}

C++: #include <stdio.h>

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

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

int main(void)
{
    int a, b;

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

    return (0);
}

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

// https://onlinejudge.u-aizu.ac.jp/problems/0005
// 正の整数 a,b を入力し、a と b の最大公約数と最小公倍数を出力するプログラムを作成して下さい。

// aとbの最大公約数を返す
int64_t euclid(int64_t a, int64_t b);

int main(){
	// 0 < a,b ≤ 2,000,000,000
	// a と b の最小公倍数は 2,000,000,000 を超えない。
	int64_t a, b;
	
	// 複数のデータセットが与えられる(入力の最後まで処理)
	while(cin>>a>>b){
		// 最大公約数（greatest common divisor）
		int64_t gcd = euclid(a,b);
		
		// 最小公倍数（least common multiple）
		// 　a×b/(aとbの最大公約数)で求まる。
		//  ただしa×bを先に計算するとオーバーフローする可能性があるので注意
		int64_t lcm = a/gcd * b;
		
		cout << gcd <<" "<< lcm <<endl;;
	}
}


// ユークリッドの互除法で最大公約数を求める
int64_t euclid(const int64_t a, const int64_t b){
	return a%b == 0 ? b : euclid(b, a%b);
}

C++: /*
Á·Ï°Ìâ£ºGCD and LCM_AOJ 0005
	´ËÌâÍØÕ¹ÁËLCM(the least common multiple)µÄÇó·¨¡£ 
*/ 

#include <cstdio>
#include <iostream>
using namespace std;

long long a, b;

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

int main()
{
	while(scanf("%lld%lld", &a, &b)!=EOF)
	{
		long long g=gcd(a, b);
		printf("%lld ", g);
		printf("%lld\n", a/g*b);//×¢ÒâÕâÀïÏÈ×ö³ý·¨£¡ 
		
	}
	
	return 0;
}

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

int gcd(int m, int n) {
  while (m != n) {
    if (m > n) {
      m = m - n;
    } else {
      n = n - m;
    }
  }
  return m;
}

int lcm(int m, int n) {
  return (m / gcd(m, n)) * n;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  int a, b;

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

  return 0;
}

C++: void printFunc(int a,int b,int c,int d,int e,int f);
long gcd(long a,long b);

int main(){
  long a = 0,b = 0;

  while(fscanf(stdin,"%d %d",&a,&b) != EOF){
    printf("%d %d",gcd(a,b),a*b/gcd(a,b));
  }

  return 0;
}

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

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

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

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

C++: #include<iostream>

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

	return gcd( b, a % b );
}

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

int main(){
	int x,y;
	while( std::cin>>x>>y )
		std::cout<<gcd(x,y)<<' '<<lcm(x,y)<<std::endl;

	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main() {
  int a, b, m, tmp_a, tmp_b;
  while (cin >> a >> b) {
    tmp_a = a;
    tmp_b = b;
    while (tmp_a != 0 && tmp_b != 0) {
      if (tmp_a > tmp_b) {
        tmp_a = tmp_a % tmp_b;
      } else {
        tmp_b = tmp_b % tmp_a;
      }
    }
    m = max(tmp_a, tmp_b);
    if (m == 0) {
      printf("%d %d", 0, 0);
    } else {
      printf("%d %d", a * b / m, m);
    }
  }
  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double gcd( double m, double n );
double lcm( double m, double n );
int main(int argc, const char * argv[])
{
    double a=0.0;
    double b=0.0;
    
    while(scanf("%lf",&a)!=EOF){
        scanf("%lf",&b);

        double g = gcd(a, b);
        double l = lcm( a,b );
        
        
        printf("%d",int(g));
        printf(" ");
        printf("%d\n",int(l));
        
    }
    
}
double gcd( double m, double n )
{
	if ( ( 0.0 == m ) || ( 0.0 == n ) )
		return 0;
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}

double lcm( double m, double n )
{
	if ( ( 0.0 == m ) || ( 0.0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n);
}

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

int LCG(int x, int y);

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

int LCG(int x, int y){
    int m = x%y;
    if(m == 0){
        return y;
    }
    LCG(y,m);
}

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

main()
{
	int m,n,r,t,min,max;
	while(cin>>m>>n)
	{
		max=m;
		min=n;
		if(n>m)
		{
			t=min;
			min=max;
			max=t;
		}
		while(r=max%min)
		{
			max=min;
			min=r;
		}
		r=m/min*n;
		cout<<min<<" "<<r<<endl;
	}
}

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

bool p[1000100];

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

C++: #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<climits>
using namespace std;
static long long a, b;

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

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

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

using namespace std;

int d(int, int);
int dd(int, int);

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

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

int dd(int a, int b)
{
  return a  / d(a, b) * b;
}

C++: #include <stdio.h>
int gcd(long long a,long long b){
	return b==0?a:gcd(b,a%b);
}
long long a,b;
int main()
{
	while(scanf("%ld%ld",&a,&b) != EOF){
		printf("%ld\n%ld\n",gcd(a,b),a * b / gcd(a,b));
	}
	return 0;
}