Go: package main

import (
	"fmt"
)

func main() {
	var a, b int
	for {
		i, _ := fmt.Scan(&a, &b)
		if i == 0 {
			break
		}

		gcd := getGCD(a, b)
		fmt.Println(gcd, getLCM(a, b, gcd))
	}
}

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

func getLCM(a, b, gcd int) int {
	return a * b / gcd
}

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

using namespace std;

int a,b;

int search(int s_a,int s_b)
{
	if(s_b==0)
		return s_a;
	
	search(s_b,s_a%s_b);
	
}

int main()
{
	int a2,b2;
	
	for(;cin >> a;)
	{
		cin >> b;
		a2=a;
		b2=b;
		
		a=max(a2,b2);
		b=min(a2,b2);
		
		
		
		a=search(a,b);
		
		cout << a << " " << a2*(b2/a) << endl;
	}
}

C++: #include<stdio.h>
int main(){
	int a,b,x,y;
	scanf("%d%d",&a,&b);
	x=a;
	y=b;
	while(a!=b){
		if(a>b){a-=b;}
		else {b-=a;}
	}
	printf("%d %d",a,x/a*y);
	return 0;
}

C++: // 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

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

	long long a, b;
	while(cin >> a >> b){
		long long gcd = __gcd(a, b);
		long long lcm = a * b / gcd;
		cout << gcd << ' ' << lcm << '\n';
	}
	return 0;
}
// Write Here

C++: #include <stdio.h>

int main(int argc, char *argv[])
{
 unsigned long a, b;

 while (scanf("%lu %lu\n", &a, &b)!=EOF) {
 unsigned long i, gcd, lcm;

 for (gcd = 1, i = 2; (i <= a) && (i <= b); i++) {
 while (1) {
 if (a % i) break;
 if (b % i) break;
 gcd *= i;
 a /= i, b /= i;
 }
 }
 lcm = a * b * gcd;

 printf("%lu %lu\n", gcd, lcm);
 }

 return 0;
}

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

int main() {
    long a,b,c,d,e,ans;
    cin >> a >> b;
    if(a<b) {
        c=a;
        a=b;
        b=c;
        c=0;
    }
    c=a;d=b;
    for(;;){
        if (c==d) {
            ans=a*b/c;
            break;
        }
        e=c-d;
        c=d;
        d=e;
    }
    return 0;
}

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

using namespace std;

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

int main(void){
    int a, b, tmp;
   
     if(a<b){
        tmp = a;
        a = b;
        b = tmp;
        }
     
     while(cin >> a >> b){
         int lcm = (a*b)/gcd(a,b);
         cout<<gcd(a,b)<<" "<<lcm<<endl;
     }
     return 0;
}

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

int gcd(int a,int b) {
  if(a < b) {
    int t = a;
    a = b;
    b = t;
  }
  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() {
  int a,b;
  while(cin >> a >> b) {
    cout << gcd(a,b) << " " << lcm(a,b) << endl;
  }
}

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

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

int main(){
	int n,m;
	while(cin>>n>>m){
		int g,l;
		g = gcd(n,m);
		l = n*m/g;
		cout<<g<<" "<<l<<endl;
	}
	return 0;
}

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

using namespace std;

int main() {
    int a,b,a2,b2;
    int lcm,gcd;
    while(cin >> a >> b){
        a2=a;
        b2=b;
        while(a != b){
        if(a>b){a = a-b;}
        else{b=b-a;}
        }
        lcm = a;
        gcd=a2 / lcm * b2;
        cout << lcm << " " << gcd << endl;
    }

}

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( ( t = a % b ) != 0 ){ a = b; b = t; }
  return b;
}
long long lcm( long long a, long long b )
{
  return a * b / gcd(a,b);
}
int main( void )
{
  long long a,b;
  while( 1 ){
    cin >> a >> b;
    if( cin.eof() ) break;
    cout << gcd( a, b ) << ' ' << lcm( a, b ) << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
long long aaa(long long a,long long b){
	while(1){
		a=a%b;
		if(a==0)break;
		swap(a,b);
	}
	return b;
}

int main(){
	long long a,b;
	while(scanf("%lld%lld",&a,&b)!=EOF){
		long long t=aaa(a,b);
		cout<<t<<" "<<a/t*b<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
//最大公約数
int gcd(int a, int b) {
    if (b == 0) return a;
    else return gcd(b, a%b);
}

//最小公倍数
int lcm(int a, int b) {
    int ret = gcd(a,b);
    ret = a*(b/ret);
    return ret;
}

int main(int argc, const char * argv[])
{
    int a, b;
    while (~scanf("%d %d", &a, &b)) {
        printf("%d %d\n", gcd(a, b), lcm(a, b));
    }
    return 0;
}

C++: /*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a<c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(long int &a,long int &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(long long int &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int index=0 ; index<b ; index++)scanf("%d",&a[index])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

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

int main()
{
	LL a,b;
	while(scanf("%lld %lld",&a,&b)!=EOF)
	{
		LL gcdz=gcd(a,b);
		LL lcm=(a*b)/gcdz;
		printf("%I64d %I64d\n",gcdz,lcm);
	}
	
	return 0;
}

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

/*
8 6
50000000 30000000


2 24
10000000 150000000
*/

int A = 0;
int B = 0;

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

    return gcd(b, a % b);
}

void solve() {
    int d = gcd(A, B);
    int m = A / d * B;

    printf("%d %d\n", d, m);
}

int main() {
    while (scanf("%d %d", &A, &B) != EOF) {
        solve();
    }

    return 0;
}

C++: #include<cstdio>
#include<iostream>
     
using namespace std;
    
int gcd(int a, int b){

  if(b == 0)  return a;

  return gcd(b, a % b);
}
     
int lcm(int a, int b, int ans_gcd) {
  int ans;
  
  ans = a / ans_gcd * b;

  return ans;
}
     
     
     
     
int main(){
  int a, b;
  int ans_gcd, ans_lcm;

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

    ans_gcd = gcd(a, b);
    ans_lcm = lcm(a, b, ans_gcd);

    cout << ans_gcd << " " << ans_lcm << endl;
  }

  return 0;
}