Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [100]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == 0 {
			break
		}
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

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

using namespace std;

int GCD(const int& a, const int& b) {
	if (b == 0) {
		return a;
	}
	return GCD(b, a%b);
}

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

C++: #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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; }

int gcd(int a, int b) {
  return b != 0 ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
  return a / gcd(a, b) * b;
}
int a,b;

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

C++: /*****include*****/
#include <iostream>
#include <fstream>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/
long long int find_gcd(long long int int_a,long long int int_b){
	if(int_a == 0)	return int_b;
	else			return find_gcd(int_b%int_a,int_a);
}
/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return;
	}
#endif
	/*****変数置き場*****/
	
	
	
	/*****処理部*****/
	long long int int_a,int_b;
	long long int gcd,lcm;
	while(1){
		cin >> int_a >> int_b;
		gcd = find_gcd(int_a,int_b);
		lcm = int_a * int_b / gcd;
		cout << gcd << " " << lcm << endl;
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}

C++: #include<stdio.h>

int min(int a,int b){
  int t=a;
  if(t>b) t=b;
  return t;
}

int main(void){
  int a,b,g,l;
  int m;
  /*  char line[100];

  fgets(line,sizeof(line),stdin);
  sscanf(line,"%d %d",&a,&b);
  */
  m=min(a,b);
  int i=m;
  for(i;i>=1;i--){
    if(a%i==0 && b%i==0){
      g=i;
      i=0;
    }
  }

  l=a*b/g;

  printf("%d %d",g,l);
  return 0;
}

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

int main(){
	int a,b,gcd=1,lcm=1;
	while(cin >> a >> b){
		int c=a,d=b;
		for(int i = 2; i < a || i < b; i++){
			if(c%i==0&&d%i==0){
				c/=i;
				d/=i;
				lcm=gcd*=i;
			}
		}
		lcm*=c*d;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

int main(void)
{
	int a, b;
	while(cin >> a >> b){
		int max = 1, min = 1;
		for (int i = 2; ; ++i)
		{
			if(a % i == 0 && b % i == 0){
				a /= i;
				b /= i;
				max *= i;
				min *= i;
				i--;
			}
			if(a / i == 0 && b / i == 0){
				break;
			}
		}
		min *= a * b;
		cout << max << " " << min << endl;
	}
}

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

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

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

int main() {
    int a, b;
    while(cin >> a >> b){
        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(a < b) swap(a, b); 
  if(a % b == 0) return b;
  else return gcd( a - b, b);
}

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

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
#include <iterator>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i, a, cont, next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i, a, b, step) repfn(i, a, i < b, i + step)
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())

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

int gcd(int a, int b) {
  if (a < b)
    return gcd_h(b, a);
  else
    return gcd_h(a, b);
}

int lcm(int a, int b) {
  int g = gcd(a, b);
  if (g) {
    return (a / g) * b;
  } else {
    return 0;
  }
}

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

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	long a, b;
	int gcd;
	while (cin >> a >> b) {
		for (int i = min(a,b); i > 0; i--)
		{
			if (a%i == 0 && b%i == 0)
			{
				gcd = i;
				cout << i << " ";
				goto Cs;
			}
		}
		Cs:
		cout << a / gcd * b << endl;
		for (int i = 0; i < 0; i++){}
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
int main()
{
    int a,b;
    while (cin >> a >> b)
    {
        cout << __gcd(a,b) << " " << (long long)a*b/__gcd(a,b) << endl;
    }
}

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

int gcd( unsigned int, unsigned int );
int main(void)
{
	unsigned int a, b, g, l;

	while( std::cin >> a >> b ){
		g = gcd( a, b );
		l = a * b / g;
		std::cout << g << std::endl;
		std::cout << l << std::endl;
	}

	return 0;
}

int gcd( unsigned int a, unsigned int b ){
	int n, i;
	unsigned int tmp[3];

	tmp[0] = std::max( a, b );
	tmp[1] = std::min( a, b );

	for( n = 0;; n++ ){
		for( i = 1;; i++ ){
			tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i;
			if( tmp[( n + 2 ) % 3 ] < tmp[( n + 1 ) % 3 ] ){
				break;
			}else if( tmp[ n % 3 ] * tmp[( n + 1 ) % 3 ] * tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[0] + tmp[1] + tmp[2] - std::max( tmp[0], std::max( tmp[1], tmp[2] ));  
			}

			std::cout << "tmp[ n % 3 ] = " << tmp[ n % 3 ] << std::endl;
			std::cout << "tmp[( n + 1 ) % 3 ] = " << tmp[( n + 1 ) % 3 ] << std::endl;
			std::cout << "tmp[( n + 2 ) % 3 ] = " << tmp[( n + 2 ) % 3 ] << std::endl;
		}
	}

	return -1;
}

C++: #include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <algorithm>
#include <stack>

using namespace std;

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

int icm(int m,int n){
	if(m == 0 || n == 0){
		return 0;
	}
	return ((m / gcd(m,n)) * n);
}

int main(){
	int m = 0,n = 0;
	int resGcd = 0,resIcm = 0;
	while(cin >> m >> n){
		resGcd = gcd(m,n);
		resIcm = icm(m,n);
		cout << resGcd << " " << resIcm << endl;
	}
	return 0;
}