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>
using namespace std;
 
template<class T> T gcd(T a, T b) {
    return b ? gcd(b, a%b) : a;
}

template<class T> T lcm(T a, T b) {
    return a*b / gcd(a, b);
}
 
int main(int argc, char** argv) {
    unsigned long long a, b;
    while(cin >> a >> b) {
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <stack>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>

using namespace std;

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



int main()
{
	int a, b;
	while (cin >> a) {
		cin >> b;
		cout << gcm(a, b) << " " << (a*b) / gcm(a, b) << endl;
	}
		





}

C++: #include<iostream>
using namespace std;
int gcd(int a,int b) {
  if(a<b) {
    int tmp=a;
    a=b;
    b=tmp;
  }
  if(a%b==0) return b;
  return gcd(b,a%b);
}

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
	long long a,b,x,y,n,count=0;
	while(cin>>a>>b){
		if(a==0&&b==0)break;
		if(a>=b){
			x=a;y=b;
		}else{
			x=b;y=a;
		}
		while(1){
			if(y==0)break;
			x=x%y;
			swap(x,y);
		}
		n=a*b/x;
		cout<<x<<" "<<n<<endl;

	}
	return 0;
}

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

int main(){
	int a,b;
	while(cin >> a >> b){
		int gcd = a, lcm;
		while(a%gcd != 0 || b%gcd != 0) gcd--;
		lcm = (a\gcd)*(b\gcd)*gcd;
		cout << gcd <<" "<< lcm << endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
int main(){int a,b;while(2==scanf("%d%d",&a,&b))printf("%d %d\n",std::__gcd(a,b),a/std::__gcd(a,b)*b);return 0;}

C++: #include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<queue>
#include<string.h>
using namespace std;
inline long long gcd(long long  a,long long b)
{return b?gcd(b,a%b):a;}
inline long long lcm(long long a,long long b)
{return a/gcd(a,b)*b;}
long long x,y;
int main()
{
	while(~scanf("%lld %lld",&x,&y))
	{
		printf("%lld %lld\n",gcd(x,y),lcm(x,y));
	}
}

C++: #include <iostream>
#include <math.h>

using namespace std;

int calc_gcj(int a, int b) {
	int A=0, B=0;
	if (a == max(a,b)) {
		A = a;
		B = b;
	} else {
		A = b;
		B = a;
	}
	if (A == B) return A;
	else return calc_gcj(B,A-B);
	return -1;
}

void solve(int a, int b) {
	int gcj = calc_gcj(a,b);
	int lcm = a/gcj*b;
	cout << gcj << " " << lcm << endl;
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		solve(a,b);
	}
	return 0;
}

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

int GCD(int a, int b)
{
    int c = (a < b)? a : b;
    for (int i = 1; i <= c; ++i) {
        int d = c / i;
        if ( a % d + b % d == 0)
            return d;
    }
    return 1;
}

int LCM(int a, int b)
{
    int c = (a < b)? b : a;
    for (int i = 1; c * i <= 2000000000; ++i) {
        int d = c * i;
        if (d % a + d % b == 0)
            return d;
    }
    return -1;
}

int main(void)
{
    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 gcd(int, int);
int lcm(int, int);

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

	return 0;
}

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

int lcm(int a, int b){
	int tmp = gcd(a, b);
	return tmp ? (a / tmp * b):0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define repp(i,n) for(int i=1; i<n; i++)
using namespace std;
int Max(int n, int m){
  vector<int> v1;
  vector<int> v2;
  repp(i,n){
    if(n%i == 0) v1.push_back(i);
    if(m%i == 0) v2.push_back(i);
  }
  int t=0;
  rep(i,v1.size()){
    rep(j,v2.size()){
      if(v1[i] == v2[j] && t < v2[j]) t = v2[j];
    }
  }
  return t;
}
int main(){
  int n,m;
  while(cin >> n >> m){
    int a = Max(n,m);
    int b = n/a*m;
    cout << a << " " << b << endl;
  }
  return 0;
}

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

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

int main() {
  for(int a, b; cin >> a >> b; ) {
    int g = gcd(a,b);
    cout << g << " " << a / g * b << endl;
  }
}

C++: #include<iostream>
using namespace std;
int main() {
    long long a,b,t,GCD,LCM,g;
    while(cin >> a >> b) {
        g = a*b;
        while(b) {
            t = b;
            b = a % b;
            a = t;
        }
        GCD = a;
        LCM = g/a;
        cout << GCD << " " << LCM << endl;
    }
    return 0;
}

C++: #include<iostream>

int main(){
	long int a, b, r;
	
	while(std::cin >> a >> b){
		long int product = a*b;
		
		// GCD
		if(a < b){
			long int temp = a;
			a = b;
			b = temp;
		}
		while((r = a%b) != 0){
			a = b;
			b = r;
		}
		
		// LCM
		long int lcm = product / b;
		
		// show
		std::cout << b << " " << lcm << std::endl;
	}
	
	return 0;
}}

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

using namespace std;

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

	while (cin >> a >> b){
		int ac, bc;
		ac = a;
		bc = b;
		if (bc > ac) swap(ac, bc);
			while (ac % bc != 0){
				ac %= bc;
			if (bc > ac) swap(ac, bc);
		}
		gcd = bc;
		lcm = a * b / gcd;
	
		cout << gcd << " " << lcm << endl;
		}
	return 0;
}

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

using namespace std;

int d(int, int);
int dd(int, int);

int main(){
  int a, b;
  while(cin >> a >> b)
  {
    printf("%d %d\n", d(a, b), dd(a, b));
  }
  return 0;
}

int d(int a, int b)
{
  if(a == 0)
    return b;
  if(b == 0)
    return a;
  if(a > b)
  {
    return d(b, a % b);
  }
  else
    return d(a, b % a);
}

int dd(int a, int b)
{
  return a  / d(a, b) * b;
}

C++: #include <iostream>

using namespace std;

typedef long long int lli;

lli gcd(lli a, lli b)
{
  return (b>0)? gcd(b, a%b) : a;
}

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

int main()
{
  lli a, b;

  while(cin>>a>>b){cout << gcd(a, b) << " " << lcm(a, b) << endl;}

  return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
	while(cin >> a >> b) {
		int g = min(a, b);
		while(true) {
			if(a % g == 0 && b % g == 0) break;
			g--;
		}
		cout << g << ' ' << a / g * b << endl;
	}
}

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

int main(){
	long long unsigned int a, b, gcd, lcm, x, y, r;
	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r = x % y){
			x = y;
			y = r;
		}
		gcd = y;
		lcm = a * b / gcd;

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

	return 0;
}