Go: package main

import "fmt"

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

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d", G, L)
	}
}

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

using namespace std;

int a, b;
int gcd, lcm;

void GCD(){

	int big, small;

	big = a;
	small = b;

	while (big) {
		if (small > big) swap(big, small);
		big = big % small;
	}
	gcd = small;

}

void LCM() {
	lcm = a / gcd * b;
}




int main(){
	while (cin >> a >> b) {

		GCD();
		LCM();
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

int main(){
   int a = -1;int b = 0;int i = 1;int g = 0;int seki = 1;
	   cin >> a >> b;
          seki = a*b;
	if(a == -1){
		break;
		}
	if(a < b){
		i=a;
		a=b;
		b=i;
		}
for(i = 1;i <= 50;i++){
   
if(b == 1){
  g = a;
  break;
  }
else {
 a = a%b;
 i=a;
 a=b;
 b=i;
 }
}
cout >> g >> " " >> seki/g >> endl;

    return 0;
}

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 <cstdio>

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

int main() {
    while (1) {
        int a, b;
        int ret = scanf("%d%d", &a, &b);
        if (ret < 0) break;
        int g = gcd(a, b);
        printf("%d %d\n", g, a / g * b);
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

long saidai(long a,long b){

	for(long i=a ;i>0 ;i-- ){
		
		if(a%i==0 && b%i==0){
			return i;
			break;
		}
	}
}

long saisho(long a,long b){
	long t;
	//t=a*b;
	for(long i=a ;i<=2000000000 ;i++){
		if(i%a==0 && i%b==0){
			return i;
			break;
		}
	}
	//return a*b;
}

int main(){
	long a,b;

	while(cin >> a >> b){

	cout << saidai(a,b) << " " << saisho(a,b) << endl;
	}
	return 0;
	
}

C++: #include<iostream>

using namespace std;

long yakusuu(long a,long b){
	int t;
	if(a>=b) t=a;
	if(a<b) t=b;
	
	for(long i=t ;i>=1 ;i--){

			if(a%i==0 && b%i==0){
				return i;
				break;
			}
	}
}

long baisuu(long a,long b){

	for(long i=1;i<=a*b ;i++){
		if(i%a==0 && i%b==0){
			return i;
			break;
		}
	}
}


int main(){


	long a,b;
	long R,L;

	cin >> a >> b;

	R=yakusuu(a,b);
	L=baisuu(a,b);

	cout << R << " " << L <<endl;

	return 0;

}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int gcd(int a, int b){
    int p,q,r;if(a<b){
        p=b;b=a;a=p;
        }
        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>
using namespace std;

long long gcd(long long a,long long b)
    {long long t;if(a>b)t=a,a=b,b=t;while(a)t=a,a=b%a,b=t;return b;}
long long lcm(long long a,long long b){return a*b/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>
#include<stdio.h>
#include<math.h>
using namespace std;

int gcd(int u, int v) {
  int r;
  while (0 != v) {
    r = u % v; u = v; v = r; /* swap */
  }
  return u;
}

int main(){
	int a,b,x;
	while(scanf("%d",&a)!=EOF){
		cin>>b;
	cout<<gcd(a,b)<<" ";
	x=a*b;
	if(a<b){
		int tmp = a;
		a = b;
		b = tmp;
	}
	cout<<x/gcd(a,b)<<endl;
	}
    return 0;
}

C++: #include <cassert>
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

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

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

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

C++: #include <iostream>
using namespace std;
int gcd(int x,int y){
	if(x==0)return y;
	return gcd(y%x,x);
}
int main(){
	while(true){
		int a,b;
		cin>>a>>b;
		if(cin.eof())return 0;
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
}

C++: #include <iostream> 
#include<string.h>
#include<stdio.h>
using namespace std;
long long cc( long  long  q, long long  p)
{

	if(q%p==0)
	{
		return p;
	}
	else
	return cc(p,q%p);
}
main()
{
	long long x,y,a[1000],b[1000];
	int i=0;
	while(scanf("%lld%lld",&x,&y)!=EOF)
	{
	  
		 a[i]=cc(x,y);
		 b[i]=x/a[i]*y;
	     i++;	
	     
	}
	for(int j=0;j<i;j++)
	{
		printf("%lld %lld\n",a[i],b[i]);
	}
}

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

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

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

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

C++: # include <iostream>

unsigned long a, b;

unsigned long gcd(unsigned long x, unsigned long y) {
	return (y == 0) ? x : gcd(y, x%y);
}

unsigned long  lcm(unsigned long x, unsigned long y, unsigned long g) {
	return x / g*y;
}

int main() {
	while (1) {
		if (std::cin.eof())
			break;
		std::cin >> a >> b;
		unsigned long res1, ans;
		if (a < b)
			res1 = gcd(b, a);
		else
			res1 = gcd(a, b);
		ans = lcm(a, b, res1);
		std::cout << res1 <<' '<< ans << std::endl;
	}
	return 0;
}

C++: #include "cstdio"
#include "cstring"
#include"algorithm"
using namespace std;
long long gcd(long long a,long long b)
{
	if(a<b)return gcd(b,a);
	if(b==0)return a;
	return gcd(b,a%b);
}
long long lcm(long long a,long long b)
{
	return a*b/gcd(a,b);
}
int main()
{
    //freopen("input.txt","r",stdin);
   	long long a,b;
   	while(scanf("%lld%lld",&a,&b)!=EOF)
   	{	
   		printf("%lld %lld\n",gcd(a,b),lcm(a,b));
   	}

    return 0;
};

C++: #include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
long long a,b,aa,bb;
long long c,d,tmp;
while(cin>>a>>b){
        if(a < b)swap(a,b);
        aa=a;
        bb=b;
        while(b!=0){
                tmp = a%b;
                a = b;
                b = tmp;
        }
        c=aa*bb/a;
        cout<<a<<' '<<c<<endl;
}
        return 0;
}