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<iostream>
using namespace std;
int main(){
    int a,b,c,x;
    cin >> a >> b;
    c=a*b;
    if(a>=b){
        x=a;
        a=b;
        b=x%b;
    }
    else if(a<b){
        b=a%b;
    }
    while(a!=0 || b!=0){
        x=a;
        a=b;
        b=x%b;
    }
    cout << a << " " << c/a << endl;
}

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

int main() {
	long long int a, b, t, aa, bb;

	while (1) {
		cin>>a;
		if (a==0)
			break;
		cin>>b;

		aa = a;
		bb = b;

		while (1) {
			if (b==0) break;

			t = b;
			b = a % b;
			a = t;
		}
		cout<<a<<" "<<aa*bb/a<<endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <stack>
#include <map>
#include <queue>
#include <algorithm>
#define PI 3.1415926535897932
#define MAX(a,b) ((a>b)?(a):(b)) // ?????§????????????
#define MIN(a,b) ((a<b)?(a):(b)) // ????°?????????????
#define INRANGE(a,b,c) ((a<=b&&b<=c)?(1):(0)) // a<=b<=c??????????????????????????????

int zeller(int y,int m,int d){ // ?????§??????
	if(m<3){y--; m+=12;}
	return (y+y/4-y/100+y/400+(13*m+8)/5+d)%7;
}

int gcd(int a,int b){	// ?????§??¬?´???°
	if(b==0) return a;
	return gcd(b,a%b);
}

int lcm(int a,int b){	// ????°???¬?????°
	return a*b/gcd(a,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<stdio.h>
#include<stdlib.h>
#include<algorithm>


int yukurid(int, int);

int main()
{
	int a, b;
	while (scanf("%d %d", &a, &b) != EOF)
	{
		int tmp = a;
		a = a < b ? b : a;
		b = tmp < b ? tmp : b;
		printf("%d %d\n", ((a*b)/yukurid(a,b)),yukurid(a, b));
	}
	return 0;

}

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

C++: #include <iostream>

//?????§??¬?´???°????±???????????????°??????(m >= n)
int calcGcd(int m, int n);
//????°???¬?????°????±???????????????°??????
inline int calcLcm(int m, int n, int gcd);

int main(){
	int gcd, lcm, a, b;
	
	while(std::cin >> a >> b){
		if(a > b) gcd = calcGcd(a, b);
		else gcd = calcGcd(b, a);
		lcm = calcLcm(a, b, gcd);
		
		std::cout << gcd << " " << lcm << std::endl;
	}
	
	return 0;
}

int calcGcd(int m, int n){
	return n == 0 ? m : calcGcd(n, m%n);
}

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

C++: #include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int v[100000];

void division(long int a,long int b,long int *L,long int *G){
  long int i;
  int j=0;
  for(i=2;i<2000000000;i++){
    if(a%i==0 && b%i==0){   //a??¨b?????¨???????????????????????????
      a/=i;  b/=i;
      v[j]=i;    //?????£???????????\????????????
      i--;
      j++;   //?????£?????????????´???´???
    }
    if(i>a || i>b){
      break;
    }
  }
  for(i=0;i<j;i++){
    (*G) *=v[i];
  }
  *L = (*G) * a * b;
}

int main(void){
  long int GCD=1;
  long int LCM=1;
  long int a,b;

  while(cin>>a>>b){
    GCD=1;LCM=1;
    division(a,b,&LCM,&GCD);
    printf("%d %d",GCD,LCM);
  }
  printf("\n");

  return 0;
  
}

C++: #include <bits/stdc++.h>
// #include "bits/stdc++.h"

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };
 
typedef long long ll;
using namespace std;
 
int main() {
  int a,b;
 
  while(cin >> a >> b){
    int g = gcd(a,b);
    cout << g << " " << a/g*b << endl;
  }
  return 0;
}

C++: #include<iostream>
main(){for(int a,b,x,y,t;std::cin>>a>>b;printf("%d %d\n",a,x/a*y))for(x=a,y=b;t=b;a=t)b=a%b;}

C++: #include <iostream>

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*b/gcd(a,b);
    }
    
    int main(void){
    // Here your code !
            int 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;
	int multi;

	while(cin >> a >> b){
		multi = a*b;

		if(a<b){
			swap(a, b);
		}

		for(; b != 0;){
			int t;
			t = b;
			b = a % b;
			a = t;
		}

		cout << a << ' ' << multi/a << endl;
	}

	return 0;
}

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

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/*
<url:>
問題文============================================================

=================================================================

解説=============================================================

================================================================
*/
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll a,b;
    while(cin >> a >> b){
        ll GCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD = gcd(a,b);
        cout << GCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD << " " << a/GCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD*b<< endl;
    }
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,x,y,L,i=0;
while(cin>>a>>b){
x=a;y=b;
while(1){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
  else if(x==y){break;}
}
L=(a*b)/x;
if(x==1){cout<<y<<" "<<y<<endl;}
else{cout<<y<<" "<<L<<endl;}
x=0;y=0;
  ++i;
  if(i==49){break;}
}
  return 0;
}

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

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

C++: #include <iostream>
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)
    {
        long long c=a*b;
        return c/gcd(a,b);
    }

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

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

int main(){

	long long a = 0, b = 0;

	while (cin >> a >> b){
		long long gcd = 0;
		long long lcm = 0;
		long long r = 0;
		long long temp_a = 0, temp_b = 0;
		long long tmp = 0;
		temp_a = a;
		temp_b = b;
		if (temp_a < temp_b){
			tmp = temp_a;
			temp_a = temp_b;
			temp_b = tmp;
		}
		while (temp_a % temp_b != 0){
			r = temp_a % temp_b;
			temp_a = temp_b;
			temp_b = r;
		}
		gcd = temp_b;
		lcm = (a / gcd) * b;
		cout << gcd << " "<< lcm << endl;


	}

	//getchar();

	return 0;
}

C++: #include <cstdio>
int a,b;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int main(){
    while(~scanf("%d%d",&a,&b)){printf("%d %lld\n",gcd(a,b),1LL*a*b/gcd(a,b));}
    return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int a, b,A, B;
	cin >> a >> b;
	int c = a;
	int d = b;
	if (a <= b)
	{
		while (a != 0)
		{
			int r = b%a;
			b = a;
			a = r;
		}
		A = b;
	}
	if (a > b)
	{
		while (b != 0)
		{
			int r = a%b;
			a = b;
			b = r;
		}
		A = a;
	}
	int e = c / A;
	B = d*e;
	cout << A << " " << B << endl;
	return 0;
}