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 <string>
#include <iostream>

using namespace std;

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

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

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


 int euclid(int a, int b){
  if (b < a) {
    int c = b;
    b=a;
    a=c;
  }
  int r=a%b ;
  while(r)
  {
  a=b;
  b=r;
  r=a%b;
  }
return b;
}
int main(){
  int a,b;
  while(cin >> a >> b)
    cout << euclid(a,b) << " "<<a*b/(euclid(a,b));
}

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

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[4];

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

	for( n = 0;; n++ ){
		for( i = 1;(tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i ) >= tmp[( n + 1 ) % 3]; i++ ){
			if( tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[( n + 1 ) % 3 ];
			}
		}
		if( n > 2000000000 ){
			return -1;
		}
	}

	return -1;
}

C++: #include <iostream>

int main(){

	u_int a, b;

	while(std::cin >> a >> b){

		u_int minmul; //least common multiple
		u_int maxdivi = 1; //greatest common divisor
		u_int small;

		if(a > b)
			small = b;
		else
			small = a;

		for(int i = 2; i <= small; i++){
			if(a % i == 0  &&  b % i == 0){
				maxdivi = maxdivi * i;
				i = 2;
			}
		}
		minmul = a * b / maxdivi;

	std::cout << maxdivi << minmul << std::endl;

	}

	return 0;
}

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

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

int main(){
	long long a,b;
	while(!cin.eof()){
		cin >> a >> b;
		long g = gcd(a,b);
		cout << g << " " << a*(b/g) << endl;
	}
	return 0;
}

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

void compare(long int* a, long int* b){
  long int tem;
  if(*a < *b){
    tem = *a;
    *a = *b;
    *b = tem;
  }
}


int main(){
  long int a, b, k;
  long int x[1000][2];
  int n = 0;


  while(cin >> a >> b){
    k = a * b;
    while(1){
      if(a == b)
        break;
      compare(&a, &b);
      a = a - b;
    }
    cout << "!!\n";
    x[n][0] = a;
    x[n][1] = k / a;
    n++;
  }

  for(int i = 0; i < n; i++)
    cout << x[i][0] << " " << x[i][1] << '\n';

  return 0;
}

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

int main(){
  long a, b;
  long l, m, n;
  while (scanf("%d %d", &a, &b) != EOF){
    cin >> a >> b;
    m = a;
    n = b;

    while (1){
      if (m <= n){
        int t = m;
        m = n;
        n = t;
      }

      if (n == 0){
        cout << m << " " << a * b / m << "\n";
        break;
      }

      l = m % n;
      m = n;
      n = l;

    }

    if (a <= 0 || b <= 0){
      break;
    }
  }

  return 0;
}

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

#define REP(i, s, n) for(int i = s; i < n; ++i)
#define rep(i, n)		 REP(i, 0, n)
#define SORT(c)			 sort((c).begin(), (c).end())
#define IINF					INT_MAX
#define LLINF					LLONG_MAX
#define DEBUG					false

int main(){
    long long int a,b,r=1;
    cin>>a>>b;
    if(a<b){
        long long int temp;
        temp=b;
        b=a;
        a=temp;
    }
    long long int tempa=a,tempb=b;
    r=b;
    b=a;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;

    }
    long long ans=tempa*tempb/b;
    cout<<b<<" "<<ans<<endl;
    return 0;
}

C++: #include <iostream>

using namespace std;

void swap(int *a, int *b)
{
	if(*b > *a) {
		int temp = *a;
		*a = *b;
		*b = temp;
	}
}

int main()
{
	int a, b;

	while (cin >> a >> b)
	{
		int A = a, B = b;
		while (a != b) {
			swap(&a, &b);

			a -= b;
		}

		cout << a << ' ' << (A/a)*B << endl;
	}

	return 0;
}

C++: #include <iostream>

/* ユークリッドの互除法 */
int _euclidean_algorithm(int a, int b)
{
    if (a % b == 0){
        return b;
    }
    return _euclidean_algorithm(b, a % b);
}

/* Greatest common divisor */
int gcd(int a, int b)
{
    return _euclidean_algorithm(a, b);
}

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

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

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

using namespace std;

double gcd(int x, int y);

int main(void) {
	while(1) {
		int x, y;
		double G, L;
		cin >> x;
		if( cin.eof() ) { break; }
		cin >> y;
		
		G = gcd(x, y);
		L = (double)x * (double)y / G;
		printf("%.0f %.0f\n", G, L);
	}
	return 0;
}

double gcd(int x, int y) {
	int t;
	while(y != 0) {
		t = x % y;
		x = y;
		y = t;
	}
	return x;
}

C++: #include <iostream>
using namespace std;
int main(){
  int a,a2,i=1,j=1,b,b2;
  cin>>a>>b;
  while(1){
    a2=a*i;
    b2=b*j;
    if(a2==b2)break; 
    else if(a2<b2)i++;
    else j++;
  }  
  if(a<b){
    for(i=2;i<a+1;i++)
      if(a%i==0 && b%i==0)break;
      cout<<i<<endl;
  }
  else {
      for(i=2;i<b+1;i++)
	if(a%i==0 && b%i==0)break;
      cout<<i<<endl;
  } 
  cout<<a2<<endl; 
  return 0;
}

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

using namespace std;

int find_GCD(int a, int b){
  int max = 0;
  for(int i=min(a, b)/2;i>0;i--){
    if(a%i==0 && b%i==0){
      max = i;
      break;
    }
  }
  return max;
}

int find_LCM(int a, int b){
  int LCM;
  for(int i = max(a, b)+1;;i++){
    if(i%a==0 && i%b==0){
      LCM = i;
      break;
    }
  }

  return LCM;
}

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

}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9 + 7/*998244353*/;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll); ll mod_fact(ll, ll); ll mod_inv(ll, ll); ll gcd(ll, ll); ll lcm(ll, ll);
//
int main(){
    ll a, b;
    while(cin >> a >> b){
        cout << gcd(a, b) << " " << lcm(a, b) << "\n";
    }
}
/*⠀⠀⠀⠀⠀⢀⣀⣀⣀    
⠀⠀⠀⠰⡿⠿⠛⠛⠻⠿⣷
⠀⠀⠀⠀⠀⠀⣀⣄⡀⠀⠀⠀⠀⢀⣀⣀⣤⣄⣀⡀
⠀⠀⠀⠀⠀⢸⣿⣿⣷⠀⠀⠀⠀⠛⠛⣿⣿⣿⡛⠿⠷
⠀⠀⠀⠀⠀⠘⠿⠿⠋⠀⠀⠀⠀⠀⠀⣿⣿⣿⠇
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠁

⠀⠀⠀⠀⣿⣷⣄⠀⢶⣶⣷⣶⣶⣤⣀
⠀⠀⠀⠀⣿⣿⣿⠀⠀⠀⠀⠀⠈⠙⠻⠗
⠀⠀⠀⣰⣿⣿⣿⠀⠀⠀⠀⢀⣀⣠⣤⣴⣶⡄
⠀⣠⣾⣿⣿⣿⣥⣶⣶⣿⣿⣿⣿⣿⠿⠿⠛⠃
⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄
⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡁
⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁
⠀⠀⠛⢿⣿⣿⣿⣿⣿⣿⡿⠟
⠀⠀⠀⠀⠀⠉⠉⠉
*/

//library//
ll mod_fact(ll a, ll mod){
    ll ans = 1;
    while(a > 1){
        ans = ans * a % mod;
        a--;
    }
    return ans; 
}
ll mod_pow(ll a, ll b, ll mod){
    ll ans = 1;
    while(b > 0){
        if(b & 1) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans;
}
ll mod_inv(ll a, ll mod){
    return mod_pow(a, mod - 2, mod);
}
ll gcd(ll a, ll b){
    while(a % b){
        return gcd(b, a % b);
    }
    return b;
}
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}