Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if count == 51 {
			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<cstdio>
int gcd(int a, int b){
  if(a == 0){
    return b;
  }else if(a > b){
    return gcd(a%b, b);
  }else if(a < b){
    return gcd(b%a, a);
  }
}
int main(){
  int a, b;
  while(~scanf("%d%d", &a, &b)){
    //scanf("%d%d", a, b);
    int c=gcd(a,b);
    printf("%d %ld\n", c, ((long)a*(long)b)/c);
  }
}

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

int euclid_alg(const int a, const int b) {
	return a > b ? a % b : b % a;
}

int main(void) {
	int a,b;
	std::vector<int> num;
	while(std::cin >> a >> b){
		num.push_back(a);
		num.push_back(b);
	}

	for(int i = 0; i < (int)num.size(); i+=2){
		int pro = num[i] * num[i+1];
		while(num[i] != 0 && num[i+1] != 0){
		if(num[i] > num[i+1]){
				num[i] = euclid_alg(num[i],num[i+1]);
			}else{
				num[i+1] = euclid_alg(num[i],num[i+1]);
			}
		}

		if(num[i] == 0){
			num[i] = num[i+1];
			num[i+1] = 0;
		}
		num[i+1] = pro / num[i];
	}

	for(int j = 0; j < (int)num.size(); j+=2){
		std::cout << num[j] << " " << num[j+1] << std::endl; 
	}

	return 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <utility>

using namespace std;

long long get_gcd(long long m, long long n) {
    /* Euclidean Algorithm */
    while (n)
        swap(m%=n, n);

    return m;
}

int main() {
    while (true) {
        long long a, b;
        if (scanf("%lld %lld", &a, &b) == EOF)
            break;

        long long gcd=get_gcd(a, b);
        printf("%lld %lld\n", gcd, a*b/gcd);
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
int GCD(int n,int m){
  if(n<m){
    int t;
    t = m;
    m = n;
    n = t;
  }
  int i;
  while(n%m != 0){
    i = n%m;
    n = m;
    m = i;
  }
  return m;
    
}
int main(){
  int n,m,i=0,a[50],b[50];
  while(cin >> n >> m){
    a[i] = GCD(n,m);
    b[i] = n*m/GCD(n,m);
    i++;
    n = 0;
    m = 0;
  }
  for(n=0;n<i+1;n++) cout << a[n] << " " << b[n] << endl;
  return 0;
}

C++: #include<iostream>

using namespace std;

//Euclidean algorithm
int gcd(long m, long n)
{
	long t;
	while (m != 0) {
		t = m, m = n % m, n = t;
	}
	return n;
}

//gcd(a, b) * lcm(a, b) = a * b
int lcm(long n, long m) {
	return n * m / gcd(n, m); 
}



int main(){
	long n, m;
	
	while(cin >> n >> m) {
		cout << gcd(n, m) << " " << lcm(n, m);
	}

	return 0;
}

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

unsigned GCD(unsigned a, unsigned b)
{
	unsigned small = (a<b)?a:b;
	unsigned gcd=1;
	for(unsigned i=2; i<=small; ++i)
	{
		if(a%i==0 && b%i==0)
		{
			gcd = i;
		}
	}
	return gcd;
}

unsigned LCM(unsigned a, unsigned b)
{
	unsigned large = (a<b)?b:a;
	for(unsigned i=large; i<2000000000; ++i)
	{
		if(i%a==0 && i%b==0)
		{
			return i;
		}
	}
}

int main()
{
	double a,b;
	while(cin>>a>>b)
	{
		cout << GCD(a,b) << ' ' << LCM(a,b) << '\n';
	}
}

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 <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define iREP(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

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(){
    
    ll a,b;
    while(cin>>a>>b){
        cout<<gcd(a,b)<<lcm(a,b)<<endl;
    }
    
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main() {
	
	int a,b,M,m,g;
	
	while(cin>>a>>b){
		if(a>b){M=a;m=b;} else{M=b;m=a;}
		for(int i=1;i<=M;i++){
			if(M%i==0&&m%(M/i)==0){g=M/i;break;}
			}
		cout<<g<<" "<<a/g*b<<endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int x, int y);  // ?????§??¬?´???°????±?????????¢??°
int lcm(int x, int y);  // ????°???¬?????°????±?????????¢??°

int main()
{
	int x, y;
	while (cin >> x >> y){
	cout << gcd(x, y) << " " << lcm(x, y) << endl;
	}

	return 0;
}

// ?????§??¬?´???°????±?????????¢??°
int gcd(int x, int y)
{
	int r;

	if (x == 0 || y == 0)  // ?????°?????§??????
	{
		fprintf(stderr, "?????°??¨????????§??????\n");
		return 0;
	}

	// ????????°?????????????????????
	while ((r = x % y) != 0) // y??§????????????????????§?????????
	{
		x = y;
		y = r;
	}
	return y;
}

// ?????§??¬?´???°????±?????????¢??°
int lcm(int x, int y)
{
	if (x == 0 || y == 0)  // ?????°?????§??????
	{
		fprintf(stderr, "?????°??¨????????§??????\n");
		return 0;
	}

	return (x * y / gcd(x, y));
}

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

int main(){
	long a, b, dmy, t, gcd, lcm;
	while( scanf("%d%d",&a,&b)!=EOF ){
		t=a*b;
		while(a!=b){
			while(a>b) a-=b;
			while(a<b) b-=a;
		}
		gcd=a;

		lcm=t/gcd;
		printf("%d %d\n",gcd, lcm);
	}
 return 0;
}

C++: /* -*- coding:utf-8 -*- */

#include <iostream>

using namespace std;

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

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

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

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

long long GCD (long long a, long long b)
{
    /*long long t;
    if (a>b) swap(a,b);
    while (1)
    {
        t=b%a;
        if (t==0) break;
        b=a;
        a=t;
    }
    return a;*/
    if (a%b==0) return b;
    else if (b%a==0) return a;
    else if (a>b) return GCD(a%b,b);
    else return GCD(b%a,a);
}

int main()
{
    long long a,b,gcd[50],lcm[50],c=0;
    while (cin>>a>>b)
    {
        gcd[c]=GCD(a,b);
        lcm[c]=a*b/gcd[c];
        c++;
    }
    for (int i=0; i<c; i++) cout<<gcd[i]<<" "<<lcm[i]<<'\n';
    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=b%a)!=0){
  q=b/a;
  b=a;
  a=r;
  }
  return a;
  
}

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