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 <stdio.h>


int main(){

	unsigned long a=0, b=0,i=0,m=0,n=0,B=0;

	while(scanf("%d%d", &a, &b)!=EOF){
		printf("%d\n",a*b);
		B = b;

		if (a < b){
			i = a;
			a = b;
			b = i;
		}

		while (1){

			n = a%b;
			if (n == 0){
				printf("%d ", b);
				break;
			}
			m = n;
			n = b%m;
			b = m;
		}
		m = a / b;
		m *= B;
		printf("%d\n",m); 
	}

	return 0;
}

C++: #include <math.h>
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <string>

#define YES "YES"
#define NO "NO"
#define space ' '

using namespace std;

void func();

int main(void)
{
	
	func();

	return 0;
}

void func()
{

	int a,b, g, l;
	while (cin >> a >> b, !cin.eof())
	{
		int d[2] = { max(a, b), min(a, b) };
		while (d[1] != 0)
		{
			d[0] %= d[1];
			swap(d[0], d[1]);
		}
		g = d[0];

		l = max(a, b) / g*min(a, b);
		cout << g << space << l << endl;
	}
}

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

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

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

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

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

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

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	int a,b,c,d,e,f,maxx=0,data,minn=0,o;
	while (scanf("%d %d",&a,&b)!=-1){
		data=max(a,b);
		while(maxx==0){
			if (a%data==0 && b%data==0) maxx=data;
			data-=1;
		}
		minn=a*b/maxx;
		cout<<maxx<<" "<<minn<<endl;
		maxx=0;
		minn=0;
	}
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


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

int lcm(int a,int b){
	int d = gcd(a,b);
	return (a/d * b/d)*d;
}

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

C++: #include <iostream>
#include <cmath>
int GCD(int a, int b) {
	while (b != 0) {
		int r = a%b;
		a = b;
		b = r;
	}
	return a;
}
int main() {
	int a, b;
	while (std::cin >> a >> b) {
		int gcd = GCD(a, b);
		int lcm = round((double)a/gcd*b);
		std::cout << gcd << ' ' << lcm << std::endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
long long n, m;
long long getGCD(long long a, long long b) {
  if (b == 0) return a;

  return getGCD(b, a % b);
}
int main() {
  freopen("in", "r", stdin);
  while (cin >> n >> m) {
    long long lcm, gcd;
    if (n < m) swap(n, m);
    gcd = getGCD(n, m);
    lcm = n * m / gcd;
    //cout << "debug" << endl;
    cout << gcd << " " << lcm << endl;
  }
  return 0;
}

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

using ULLint = unsigned long long int;

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

int Glcd(ULLint x, ULLint y, int gcd) {
	return x * y / gcd;
}

int main() {
	ULLint a, b;
	while (cin >> a >> b)
		cout << Egcd(a, b) << " " << Glcd(a, b, Egcd(a, b)) << endl;
	return 0;
}

C++: #include <iostream>
#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(){
    ll a,b;
    while(true){
        cin>>a>>b;
        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 <stdio.h>

int gcd(int m, int n)
{
  if(m<n){
    int tmp = m;
    m = n;
    n = tmp;
  }

  while(1){
    if(n==0){
      return m;
    }

    int tmp = n;
    n = m%n;
    m = tmp;
  }
}

int lcm(int m, int n)
{
  return m/gcd(m,n)*n;
}

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

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using comd = complex<double>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

template <typename T>
void out(deque < T > d)
{
  for(size_t i = 0; i < d.size(); i++)
  {
    debug(d[i]);
  }
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

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

ll lcm(ll a,ll b){
  return a*b / gcd(a,b);
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  while(cin >> a >> b) cout << gcd(a,b) << " " << lcm(a,b) << endl;
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	long long x , y , i , j , tmp , tmp2;
	while( cin >> x >> y ){
		long long n = x>y ? x:y;
		for( i=1 ; i<=n ; i++ ){
			if( x%i+y%i==0 )
				tmp = i ;
		}
		i=0;
		while(1){
			i++;
			if( i%x+i%y==0 ){
				tmp2=i;
				break;
			}
		}
		cout << tmp <<" "<< tmp2 << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

long long gcd(long long a, long long b) {
    return (a == b) ? a : gcd(b % a, a);
}

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

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

C++: #include <stdio.h>
using namespace std;

int gcd(long num1,long num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(long num1,long num2) {
	return num1 / (double)gcd(num1, num2) * num2;
}

int main() {
	long a, b;
	while (~scanf("%d %d",&a,&b)) {
		if (b > a) {
			int tmp = b;
			b = a;
			a = tmp;
		}
		printf("%d %d\n", gcd(a, b),(long)lcm(a,b));
	}
}