Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [100]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == 0 {
			break
		}
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <math.h>
typedef unsigned long long int ll;

using namespace std;

ll Euclid(ll m, ll n){
    if(n == 0)  return m;
    else        return Euclid(n, m % n);
}

int main(){
    ll gcd;    //the greatest common divisor
    ll lcm;    //least common multiple
    ll m, n, tmp;
    while (cin >> m >> n){
        if(m < n){
            tmp = m;
            m = n;
            n = tmp;
        }
        gcd = Euclid(m, n);
        lcm = m * n / gcd;
        cout << gcd << " " << lcm << endl;
    }
	return 0;
}

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

C++: #include <iostream>
#include<stdio.h>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<cstring>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    int a,b;
    while(scanf("%d%d",&a,&b)!=EOF){

        if(b>a)swap(b,a);
        ll aa=a,bb=b;
        ll o,p,q;
        while(bb!=0){
            o=bb;
            p=aa%bb;
            aa=bb;bb=p;
        }
        ll i=1;
        while(true){
            i++;
            ll ao=a*i;
            if(ao%b==0){
                q=ao;
                break;
            }
        }
        cout<<o<<" "<<q<<endl;
    }
    
    
    
    
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
main(){
	int n1,n2,a1,a2;
	while(cin>>n1>>n2){
		int mx=max(n1,n2);
		for(int i=mx;i>0;--i){
			if(n1%i==0 && n2%i==0){
				a1=i;
				break;
			}
		}
		a2=(n1/a1)*n2;
		cout<<a1<<" "<<a2<<endl;
	}
}

C++: #include <iostream>
using namespace std;
int main( void )
{
	while ( !cin.eof() )
	{
		long long a, b;
		cin >> a >> b;
		if ( cin.eof() )
			break;

		long long x = max(a,b);
		long long y = min(a,b);

		while ( y > 0 )
		{
			x -= y;
			if ( x < y )
				swap( x, y );
		}

		long long gcd = x;
		long long lcm = a*b / gcd;

		cout << gcd << " " << lcm << endl;

	}
	return 0;
}

C++: #include <bits/stdc++.h>
#include<math.h>
using  namespace std;
#define ll    long long int
#define pai     pair<int,int>
#define vi      vector<int>
#define vd      vector<double>
#define mpi     map<int,int>
#define mps     map<string,int>
#define sti     stack<int>
#define stc     stack<char>
#define sei     set<int>
#define ses     set<string>
#define multii  multiset<int>

ll gcd(ll a,ll b){
if(b==0){
    return a;
}
else{
   return gcd(b,a%b);
}
}
 int main()
{
  /*#ifndef ONLINE_JUDGE
  freopen("tin.txt","r",stdin);
  freopen("tout.txt","w",stdout);
  #endif*/

ll a,b;
while(cin>>a>>b){

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


}
}

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

unsigned int gcd(const unsigned int a, const unsigned int b) {
	unsigned int result = 1;

	for (unsigned int k = 1; k <= a and k <= b; k++) {
		if (a % k == 0 and b % k == 0) { result = k; }
	}

	return result;
}

unsigned int lcm(unsigned int a, unsigned int b) {
	unsigned int mult;

	if (a > b) {
		unsigned int tmp = a;
		a = b;
		b = tmp;
	}

	for (unsigned int k = 1; k <= a; k++) {
		mult = b * k;
		if (mult % a == 0) { return mult; }
	}

	return 0;
}

int main() {
	unsigned int a, b;
	
	while (!std::cin.eof()) {
		std::cin >> a >> b;
		std::cout << gcd(a, b) << " " << lcm(a, b) << std::endl;
	}
}

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

unsigned long long int GCD();

int main(void){
	while(1){
		unsigned long long int a, b, gcd, lcm, temp;
		if( a < b){
			temp = a;
			a = b;
			b = temp;
		}
		cin >> a >> b;
		if(a == 0 || b == 0)
			return 0;
		gcd = GCD(a,b);
		lcm = a * b / gcd;
		cout << gcd << ' ' << lcm << endl;
	}
	return 0;
}

unsigned long long int GCD(unsinged long long int a, b){
	if(a % b == 0)
		return (b);
	else
		return (GCD(b, a%b);
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <functional>
#include <iomanip>
using namespace std;

#define ll long long int

#define rep(p,q) for(int i = p; i < q;i++)

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

//5
int main(void) {
	ll a, b;
	while (cin >> a >> b) {
		ll g = gcd(a, b);
		ll l = a * b / g;
		cout << g << " " << l << endl;
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;


int main(){

	long int a, b;
	long int f;
	long int G, L, temp;

	while(cin >> a){
		cin >> b;
		f = a * b;
		if(a < b){
			temp = a;
			a = b;
			b = temp;
		}
		while(1){
			temp = a % b;
			if(temp==0) break;
			a = b;
			b = temp;
		}
		G = b;
		L = f/G;

		cout << G << ' ' << L << endl;
	}
	return 0;
}

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

int main() {
	int a,b,c,e,f;
	while(cin>>a>>b){
		int g=0,l=0;
		e=a;
		f=b;
		if(e>f){
			e=e-f;
		}
	    if(f>e){
	    	f=f-e;
	    }
	    if(f==e){
	    	l=e;
	    }
	    if(l!=0)break;
		cout<<l<<" "<<a*b/l<<endl;
	    }
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    long long i,a,b,c,d,e;
    while(cin>>a>>b){
        if(a<b){
            i=b-a;
        }
        else{
            i=a-b;
        }
    for( long long j=i;j>0;i--){
        if(a%i==0 && b%i==0){
            c=i;
            break;
        }
    }
    e=a*b/c;
        
    cout<<c<<" "<<e<<endl;
    }
    return 0;
}

C++: #include <iostream>

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

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

C++: #include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
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){
        printf("%lld %lld\n",gcd(a,b),a * b / gcd(a,b));
    }
    return 0;
}

C++: #include <cstdio>
int gcd (int a, int b) {
	while (true) {
		if (a > b)
			a -= b;
		else if (a < b)
			b -= a;
		else
			break;
	}
	return a;
}
int lcm (int a, int b) {
	int sum_a = a;
	int sum_b = b;
	while (true) {
		if (sum_a > sum_b)
			sum_b += b;
		else if (sum_a < sum_b)
			sum_a += a;
		else
			break;
	}
	return sum_a;
}
int main ( int argc, char *argv[] ) {
	using namespace std;
	int a, b;
	while (EOF != fscanf(stdin, "%d %d\n", &a, &b)) {
		printf("%d %d\n", gcd(a, b), lcm(a, b));
	}
	return 0;
}

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){
    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;
}