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>
using namespace std;
int main(){
int a,b,i;
while(cin>>a>>b){
int max=0,min;
i=1;
while(r!=0){
r=x%y;
x=y;
y=r;
}
max=x;
min=(a/max)*b;
cout<<max<<" "<<min<<endl;
}
return 0;
}

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

int gcd(int a,int b)
{
	return b==0?a: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 main()
{
	int a,b;
	while(true){
		cin >> a;
		if(cin.eof())
			break;
		cin >> b;

		int a1=0,b1=0;
		a1=a;
		b1=b;

		int sum=0;
		while(a1%b1!=0){
			sum = b1;
			b1 = a1%b1;
			a1 = sum;
		}

		int g=0,m=0;
		g=b1;
		m=a/g*b;

		cout << g << ' ' << m << endl;
	}
	return 0;
}

C++: #include <stdio.h>
long long gcd(long long a,long long b){
if(b==0)return a;
return gcd(b,a%b);
}
int main(){
long long a,b;
while(scanf("%lld%lld",&a,&b)!=EOF){
printf("%d %d\n",gcd(a,b),a*b/gcd(a,b));
}
}

C++: #include <cstdlib>
#include <iostream>
#include <iomanip>
#include <stdio.h>

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

    long a,b,c,d;
    while (std::cin >> a >> b) {
        if (a > b){
            c = a;
            d = b;
        }else{
            c = b;
            d = a;
        }
        long temp;
        while (c % d != 0){
            temp = d;
            d = c % d;
            c = temp;
        }
        std::cout << d << " " << a*b/d << std::endl;
    }
    return EXIT_SUCCESS;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++) 
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int lcm( int a, int b )
{
	int temp = __gcd( a, b );

	return temp ? ( a / temp * b ) : 0;
}
int main()
{
	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(){
  int a, b;

  while(cin >> a >> b){
    int g = __gcd(a, b);
    int l = a / g * b;

    cout << g << " " << l << endl;
  }
}

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

int getGcd(int x, int y){
  if(y==0) return x;
  getGcd(y,x%y);
}

int getLcm(int x, int y){
  for(int i=1;;i++)
    if(i%x==0 && i%y==0) return i;
}

int main(){
  int a,b;
  while(scanf("%d%d",&a,&b)!=EOF)
    printf("%d %d\n",getGcd(a,b),getLcm(a,b));
}

C++: #include <cstdio>
#include <stdlib.h>
#include <algorithm>
#define min(a,b)    (((a) < (b)) ? (a) : (b))
#define max(a,b)    (((a) > (b)) ? (a) : (b))
#define abs(x)    ((x) < 0 ? -(x) : (x))
#define INF 0x3f3f3f3f
#define delta 0.85
#define eps 1e-3
#define PI 3.14159265358979323846
#define MAX_V 10005
#define MAX_E 10000000
using namespace std;

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

int main(){
	int a, b;
	while(~scanf("%d%d", &a, &b)){
		int c = gcd(a, b);
		printf("%d %d\n", c, a * (b / c));
	}
	return 0;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
ll gcd(ll a,ll b)
{

   return b==0?a:gcd(b,a%b);
}
int main()
{
    ll a,b;
    while(cin>>a>>b)
    {
        ll t = gcd(a,b);
        cout << t << " " << a*b/t << endl;
    }

}

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

using namespace std;

typedef long long ll;

ll gcd(const ll sx, const ll sy) {
    ll x = min(sx, sy);
    ll y = max(sx, sy);
    ll tmp;
    while (x > 0) {
        tmp = y;
        y = x;
        x = tmp % x;
    }
    return y;
}

ll lcm(const ll x, const ll y) {
    return x / gcd(x, y) * y;
}

// ref. http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005
int main(void) {
    char buf[1024];
    int res;
    while (1) {
        if (fgets(buf, 1024, stdin) == NULL) {
            if (feof(stdin)) {
                return 0;
            } else {
                perror("fgets");
                return 1;
            }
        }

        ll x, y;
        sscanf(buf, "%lld %lld", &x, &y);
        cout << gcd(x, y) << " " << lcm(x, y) << endl;
    }
}

C++: // B.cpp

#include <iostream>

using namespace std;

int gcd(int, int);
int lcm(int, int);

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

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a <= b){
		max = b, min = a;
	}
	if(min == 0) return max;
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define N 2000000000
int main() {
	long long int a,b;
	while(cin>>a>>b){
		int* ahoge;
		int* bhoge;
		ahoge=(int*)malloc(sizeof(int)*N);
		bhoge=(int*)malloc(sizeof(int)*N);
		long long int i,j;
		for(i=2;i<=a;i++){
			if(a%i==0){
				int count=0;
				do{
					a=a/i;
					count++;
				}while(a%i==0);
				ahoge[i]=count;
			}	
		}
		for(j=2;j<=b;j++){
			if(b%j==0){
				int count=0;
				do{
					b=b/j;
					count++;
				}while(b%j==0);
				bhoge[j]=count;
			}	
		}
		long long int great,least,k;
		great=1;
		least=1;
		for(k=2;k<min(i,j);k++){
			great=great*pow(k,min(ahoge[k],bhoge[k]));
		}
		for(k=2;k<max(i,j);k++){
			least=least*pow(k,max(ahoge[k],bhoge[k]));
		}
		cout<<great<<" "<<least<<endl;
	}
	return 0;
}

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

bool gcd(int u, int v)
{
  int r, z;

    if(v > u)
    {
      z = u;
      u = v;
      v = z;
    }

  while((r = u%v) != 0)
  {
    u = v;
    v = r;
  }    
  return v;  
}


int main(void)
{
  int a, b, lcm;

  while(scanf("%d %d", &a, &b))
  {      
    lcm = b/gcd(a,b)*a;
    printf("%d %d\n", gcd(a,b), lcm);
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
long long gcd(long long a,long long b){
    if(b==0)
        return a;
    else return gcd(b,a%b);
}
int main(){
    long long a;
    long long b;
    //cout<<"h"<<endl;
    while(cin>>a>>b){

    cout<<gcd(a,b)<<" ";
        cout<<a/gcd(a,b)*b<<endl;}
    return 0;
}

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

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

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

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

using namespace std;

int main()
{
	unsigned long a, b, r, c, d;
	unsigned long ta, tb;

	scanf("%d%d", &a,& b);
	if (a > b){
		ta = a;
		tb = b;
	} else {
		ta = b;
		tb = a;
	}
	

	while (1) {
	r = ta % tb;
	if (r == 0) break;
	ta = tb;
	tb = r;
	}
	c = tb;

	
	d = a * (b  / c);
	

	printf("%d %d\n", c, d);

	return (0);
}

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 <iostream>
#include<string>
using namespace std;
void hideki(int x,int y){
    
}

int main(){
    int a,b;
    cin>>a>>b;
    int d=a*b;
    if(a>b)
    while(a%b!=0&&a>b){a=a%b;}
    else
    while(b%a!=0&&b>a){b=b%a;}
    int c=min(a,b);
    cout<<c<<" "<<d/c<<endl;
    
    return 0;
}