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 <iomanip>
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(int argc, char **argv)
{
	int 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 a,int b){
    while(a>0&&b>0){
        if(a>b)
            a%=b;
        else
            b%=a;
    }
    if(a==0)
        return b;
    else
        return a;
}
int main(){
    int a,b;
    while(cin>>a>>b){
        int c=gcd(a,b);
        lcm=a*b/c;
        cout<<c<<" "<<lcm<<endl;
    }
    return 0;
}

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 * b / gcd;
}




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

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

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main(void)
{
	int a, b,r,i,small,big,x;

	while (scanf("%d %d", &a, &b) != EOF){
		if (a > b){
			small = b;
			big = a;
		}
		else {
			small = a;
			big = b;
		}

		//?????§??¬?´???°
		r = big % small;
		while (1){
			x = small % r;
			if (x == 0){
				printf("%d ", r);
				break;
			}
			r = x;
			small = r;
		}
		//????°???¬?????°
		r = big % small;
		while (r != 0){
			big = small;
			small = r;
			r = big % small;
		}
		
		printf("%d\n", (a * b) / small);
	}
	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>
#include<iomanip>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<math.h>
#define L(_i,_N) for(int _i=0;_i<_N;_i++)
#define C(_Dis) cout<<_Dis<<endl;

using namespace std;

typedef long long int lli;

int main() {
	lli a, b,i;
	while (cin >> a >> b) {
		if (a > b) swap(a, b);
		for (i = a; i > 0; i--) {
			if (a%i == 0 && b%i == 0) break;
		}
		cout << i << " " << (a*b) / i << endl;
	}
	return 0;
}

C++: //
//  main.c
//  c
//
//  Created by ????????? on 2016/12/10.
//  Copyright ?? 2016??´ ?????????. All rights reserved.
//

#include <stdio.h>

int main(){
    long long a, b, r, lcm, x, y;
    while (scanf("%lld %lld",&a,&b) != EOF) {
        x=a;
        y=b;
        for (;;) {
            r=x%y;
            if (r==0)
                break;
            x=y;
            y=r;
        }
        lcm=a*b/y;
        printf("%lld %lld\n",y,lcm);
    }

    return 0;
}

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

int gcd(int x,int y){
  if(x%y==0) return n;
  else{
    int z=x%y
    return gcd(y,z);
  }
}

int main()
{
  int a,b;
  int g;
  long int l;
  cin >> a >> b;
  
  if(a>b) g=gcd(a,b);
  else if(a<b) g=gcd(b,a);
  else g=a;

  l=a*b/g;
  cout << g << " " << l << " " << endl;

  return 0;
}

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

int main(){
	long int gcd[200],num1,num2,lcm[200];
	int a,b;
	int i=0;
	
	while(cin >> a >> b){
		num1 = a;
		num2 = b;
	
		if( a<b ){
			num2 = a;
			num1 = b;
		}
		
		while( (gcd[i]=num1%num2) != 0){
			num1 = num2;
			num2 = ggd[i];
		}
		gcd[i] = num2;
		lcm[i] = a / gcd[i] * b;
		i++;
	}
	
	for(int j=0; j<i; j++)
		cout << gcd[j] <<" "<< lcm[j] << "\n";
	
	return 0;
}

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

using namespace std;

int gcn(int a,int b){
if(a < b){swap(a,b);} 
while(b != 0){
a = a%b;
swap(a,b);
}
return a;
}

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

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    long long a,b,i,f;
    cin>>a>>b;
    for(i=20000000;i>0;i--){
        if(a>=2000000000||b>=2000000000){
            break;
        }
        if(a%i==0&&b%i==0){
            cout<<i<<" ";
            
                break;
        }
    }
    f=a*b/i;
    cout<<f<<endl;
    return 0;
}

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

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;

ll gcd(ll a,ll b) {
	if (a < b) {
		swap(a, b);
	}
	if (b != 0) return gcd(b, a % b);
	else return a;
}


signed main() {
	ll a, b;
	while (cin >> a >> b) {
		ll mi = gcd(a, b);
		ll ma = a * b / mi;
		cout << mi << " " << ma << endl;
	}
}

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

int gcd(int m,int n){
	if(n==0)
		return m;
		
	return gcd(n,m%n);
}

int main(){
	while(true){
		int a,b;
		cin>>a>>b;
		
		if(cin.eof())
			break;
			
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#define LL long long
int main() {
	LL a, b;
	while (std::cin >> a >> b) {
		LL gcd = __gcd(a, b);
		std::cout << __gcd(a,b) << " " << (a*b) / gcd << std::endl;
	}
	return 0;
}

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

unsigned int GCD(unsigned int, unsigned int);

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

unsigned int GCD(unsigned int a, unsigned int b) {
  unsigned int c;
  do {
    if (a > b) {
      c = a %= b;
    } else {
      c = b %= a;
    }
  } while (c != 0);
  return a != 0 ? a : b;
}

C++: #include <iostream>
int Gcd(int a, int b) // Greatest Common Divisor
{
    if (!a || !b) {
        return 0;
    }
    while (a != b) {
        if (a > b) {
            a -= b;
        } else {
            b -= a;
        }
    }
    return a;
}
int Lcm(int a, int b, int gcd) // Least Common Multiple
{
    if (!a || !b) {
        return 0;
    }
    return (a * b)/gcd;
}
int main()
{
    int a, b;
    int gcd;
    std::cin >> a >> b;
    gcd = Gcd(a, b);
    std::cout << gcd << " " << Lcm(a, b, gcd) << "\n";
}

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 <bits/stdc++.h>
using namespace std;

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

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