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 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>
#include <math.h>

int u(int a, int b);
int l(int a, int b);

int main(){
  int a, b;
  int gcd, lcm;
  
  while(scanf("%d", &a)!=EOF){
    scanf("%d", &b);
    //gcd = u(a, b);
   lcm = l(a, b);
//printf("%d %d\n",gcd, lcm);
    //std::cout << gcd << " " << lcm << std::endl;
  }
  
  return 0;
}

int u(int a, int b){
  while(a==1 || b==1){
    if(a>=b){
      a = a % b;
    }else{
      b = b % a;
    }
  }
  
  if(a==1){return b;}
  else{return a;}
}

int l(int a, int b){
  int i = 2;
  int odd = 1;
  if(a%2==0) return 2;
  else i++;
  
  while(1){
    if(a%i==0){
      if(b%i==0){break;}
      else{i += 2;}
    }else{
      i += 2;
    }
  }
  return i;
}

C++: #include <stdio.h>

long long gcd(long long,long long);

int main()
{
	long long a,b,Gcd,Lcm;
	while(scanf("%lld %lld",&a,&b) != EOF){
		Gcd = gcd(a,b);
		Lcm = a * b / Gcd;
		printf("%lld %lld\n",Gcd,Lcm);
	}

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

C++: #include <iostream>
using namespace std;
int a1,a2;
int gcd,lcm;

int GCD(int a,int b){
    int i = 2;
    int minimum = min(a,b);
    if (minimum == 0){
        i = 0;
    }
    else if (minimum == 1){
        i = 1;
    }
    else {
        for (; i <= minimum; i++) {
            if (a % (minimum - i + 2) == 0 && b % (minimum - i + 2) == 0) {
                i = minimum - i + 2;
                break;
            } else if (i == minimum) {
                i = 1;
                break;
            }
        }
    }
    return i;
}

int main(){
    while(cin >> a1 >> a2) {
        gcd = GCD(a1,a2);
        if (gcd == 0){
            lcm = 0;
        }
        else{
            lcm = a1*a2/gcd;
        }
        cout << gcd << " " << lcm << endl;
    }
}

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

#define add push_back
#define inf 2147000000

#define rep(i,n) for(int i=0;i<n;i++)
#define deb(a) cout<<a<<endl
#define out(a) cout<<a<<endl;

using namespace std;

int main(void){
	int a,b,bin;
	while(scanf("%d",&a)!=EOF){
		scanf("%d",&b);
	int aa=a,bb=b;
	if(a<b){
		swap(a,b);
	}
	
	while(b != 0){
		
		bin=a%b;
		a=b;
		b=bin;
	}
	
	out(a);
	out(aa/a*bb);
	}
}

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


int yukurid(int, int);

int main()
{
	int a, b, tmp;
	while (scanf("%d %d", &a, &b) != EOF)
	{
		tmp = a;
		a = a < b ? b : a;
		b = tmp < b ? tmp : b;
		printf("%d %d\n", yukurid(a, b),((a*b)/yukurid(a,b)));
	}
	return 0;

}

int yukurid(int a, int b)
{
	int tmp;
	if (a%b == 0)return b;
	else
	{
		tmp = a;
		a = b;
		b = tmp%b;
		return yukurid(a, b);
	}
}

C++: #include <iostream>
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 / gcd(a, b)) * b);
}
 
int main(){
    int a, b;
 
    while( cin >> a >> b ){
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    }
}

C++: #include <iostream>

using namespace std;

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

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

int gcd(int a, int b)
{
	int r = a % b;
	if (r == 0) {
		return b;
	}
	return gcd(b, r);
}
int lcm(int a, int b)
{
	if(a == 0 || b == 0) {
		return 0;
	}
	//return (a * b) / gcd(a, b);
	return ((a / gcd(a, b)) * b);
}
int main()
{
	int n, m;
	vector<int> t;
	
	// 前処理をするとさらに早くすることが出来る
	while (cin >> n >> m) {// while(cin >>n, n)なら1行で住む
		if (n == 0 && m == 0) {
			break;
		}
		// 出力
		cout << gcd(n, m) << " " << lcm(n, m) << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
typedef int ll;
/*ll gcd(ll a,ll b){
    return (b == 0)?a:gcd(b, a % b);
}*/

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

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

int main() {
	int a, b, c=0, d=0;
	int gcd, lcm;
	while(cin >> c >> d){
		a += c;
		b += d;
		if(a<b){
			int tmp = a;
			a = b;
			b = tmp;
		}
		int r = a % b;
		while(r != 0){
			a = b;
			b = r;
			r = a % b;
		}
		gcd = b;
		lcm = c*d/gcd;
		cout << gcd << ' ' << lcm << endl;
	}
	return 0;
}

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

int main(){
	int a, b, r, x, y;

	while ( cin >> a >> b ){

		if ( a >= b ){
			x = a;
			y = r = b;
		}else{
			x = b;
			y = r = a;
		}

		while ( 1 ){
			r = x % y;
			if ( !r ) break;
			x = y;
			y = r;
		}

		x =  ( a / y ) * b ;

		cout << y << " " << x << endl;
	}

	return 0;
}

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

int gcd(int x,int y);

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

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

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

std::pair<unsigned int, unsigned int> solve(unsigned int a, unsigned int b){
	std::pair<unsigned int, unsigned int> ans;
	std::vector<unsigned int> divs;
	unsigned int n = 2;

	while(true){
		if( a < n || b < n ) break;
		if(	a % n == 0 &&
			b % n == 0){
			divs.push_back(n);
			a /= n;
			b /= n;
			n = 2;
		}else{
			n++;
		}
	}

	ans.first = 1;
	for(unsigned int n : divs){
		ans.first *= n;
	}

	ans.second = ans.first*a*b;

	return(ans);
}

int main(){
	std::vector<std::pair<unsigned int, unsigned int>> ans;

	unsigned int a,b;
	while(true){
		std::cin >> a >> b;
		if(std::cin.eof()) break;
		ans.push_back(solve(a,b));
	}

	for(auto&& a : ans){
		std::cout << a.first << " " << a.second << std::endl;
	}
	
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int main(){
    int a,b;
    while(scanf("%d %d",&a,&b)){
        int i,c,ans1,ans2;
        c=a;
        if(a<b){
            a=b; b=c;
        }
        i=a%b;
        ans2=b;
        while(i){
            c=i;
            i=b%i;
            b=c;
        }
        ans1=b;
        ans2=ans2/b*a;
        printf("%d %d\n",ans1,ans2);
    }
    return 0;
}

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

int main(){
int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(true){
		if(a==0||b==0)break;
		int tmp=a;
		a=b;
		b=tmp-b;
		if(a<b){
		b=1;
		break;
		}
		if(a==0||b==0)break;
		if(a%b==0)break;
	}
	if(a==0)a=1;
	if(b==0)b=1;
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

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

int main(){
    long long a,b,temp,cobai[50],coyaku[50],i=0,clm;

    while (std::cin){
        std::cin >> a >> b;
        clm = a*b;

        if (a<b){
            std::swap(a,b);
        }

        while (b!=0){
            temp = b;
            b = a%b;
            a = temp;
        }
        coyaku[i] = a;
        cobai[i]  = clm/a;
        i++;
    }
    for (int j=0;j<i-1;j++){
        std::cout << coyaku[j] << " " << cobai[j] << std::endl;
    }
}