Go: package main

import "fmt"

func GCM(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return GCM(b, a % b)
}

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d", G, L)
	}
}

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",lcm, gcd);
    //std::cout << lcm << " " << gcd << 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;
  
  while(1){
    if(a%i==0){
      if(b%i==0){return i;}
      else{i++;}
    }else{
      i++;
    }
  }
}

C++: #include<iostream>
using namespace std;
long long gcm(long long a, long long b){
	if(b > a){
	long long d;
	d = a;
	a = b;
	b = d;
	}	
	long long c;
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}
void main(){
	long long c,d,e;
	std::cin>>c>>d;
	e = gcm(c,d);
	std::cout<<e<<" "<<(c*d)/e;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include <math.h>
#include <iostream>
using namespace std;
int main()
{
    long long a,b,s,d, l, k;
    while(scanf("%lld%lld",&a,&b)!=EOF){
    s=max(a, b);
    k=min(a, b);
    while(k>0){
        if(a%k==0&&b%k==0) break; 
        else k=k-1;
    } 
    l=k;
    printf("%lld %lld", l,(a*b)/l);
    }
    return 0;
}

C++: #include<iostream>
#include<iomanip>
unsigned int gcd(unsigned int a, unsigned int b)
{
	unsigned int a_p = b, b_p = a % b;
	return b_p == 0 ? a_p : gcd(a_p, b_p);
}
int main()
{
	unsigned int result[50][2];
	int num;
	for(int i = 0;; i++)
	{
		int a, b;
		std::cin >> a >> b;
		if(std::cin.eof())
		{
			num = i;
			break;
		}
		result[i][0] = gcd(a, b);
		result[i][1] = a / result[i][0] * b;
	}
	for(int i = 0; i < num; i++)
	{
		std::cout << result[i][0] << ' ' << result[i][1] << std::endl;
	}
	return 0;
}

C++: #include<cstdio>
long long gcd(long long a,long long b)
{
	if(b==0LL)
		return a;
	return gcd(b,a%b);
}
int main()
{
	long long a,b;
	while(~scanf("%lld%lld",&a,&b))
	{
		long long d=gcd(a,b);
		printf("%lld %lld\n",d,a/d*b);
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

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

  int z = x % y;

  return gcd(y, z);
}

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

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

int gcd(int m,int n)
{
	if((m == 0) || (n == 0)) return 0;

	while(m != n)
	{
		if(m > n) m = m -n;
		else n = n -m;
	}

	return m;
}

int lcm(int m,int n)
{
	if((m == 0) || (n == 0)) return 0;
	return ((m / gcd(m,n)) * n);
}


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

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

int main(){
	long long unsigned int a, b, r, gcd, lcm, x, y;
	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r != 0){
			r = x % y;
			x = y;
			y = r;
		}
	
		gcd = x;
		lcm = a * b / gcd;	
	
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

unsigned long gcd(unsigned long a, unsigned long b){
	unsigned long q;
	while(q = a % b){
		a = b;
		b = q;
	}
	return b;
}

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

int main(){
	unsigned long a, b;
	while(scanf("%ld %ld", &a, &b)){
		printf("%ld %ld", gcd(a, b), lcm(a, b));
	}

	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int f(int a,int b)
{
	if(a<b)
	swap(a,b);
	if(a==b)
	return a;
	int m;
	while(b)
	{
		m=a%b;
		a=b;
		b=m;
	}
	return a;
}
int main()
{
	int a,b;
	while(cin>>a>>b)
	{
		cout<<f(a,b)<<" "<<a/f(a,b)*b<<endl;
	}
}

C++: #include<iostream>

using namespace std;

int gcd(int m,int n){
   if(m<n) swap(m,n);
   while(true){
      if(n==0) return m; 
      int tmp=n;
      n=m%n;
      m=tmp;
  }
}

int lcm(int a, int b){
//   cout <<a*b<<endl;
   return (a/gcd(a,b))*b;
}

int main(){

   int a,b;

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

   return 0;

}

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

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

		while (1){

			if (b == 0){
				printf("0 ");
				break;
			}

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

			m = a / b;/*/公倍数*/
			m = m*B;
			printf("%d\n", m);
		}
	}

	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
#define long long ll;
int main(){
ll  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(1){
		ll tmp=b;
		b=a%b;
		a=tmp;
		//cout<<a<<b<<endl;
		if(b==0)break;
	}
	cout<<a<<" "<<ta*tb/a<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

lint gcd(lint a, lint b) {
	//aとbの最大公約数を返す
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(a % b, b);
}

lint lcm(lint a, lint b) {
	//aとbの最小公倍数を返す
	return a / gcd(a, b) * b;
}

int main() {
	lint A, B;
	while (cin >> A >> B) {
		cout << gcd(A, B) << ' ' << lcm(A, B) << endl;
	}

}

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

using namespace std;

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

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

C++: #include <iostream>
using namespace std;
int main(){
    long int a,b,lcm=0,count=0;
    while(cin>>a>>b){
        count++;
        if(count>50)break;
    for(int k=a;k>=1;k--){
        if(a%k==0&&b%k==0) {
            lcm=k;
            break;
        }
    }
    cout<<lcm<<" "<<a*b/lcm<<endl;
}
}

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

int main() {
  int a, b, c, d, tmp;
  int gcd, lcm;
  while(cin >> a >> b) {
    c = a;
    d = b;
    while(true) {
      if(c == d) break;

      if(c > d) {
        tmp = c;
        c = d;
        d = tmp;
      }

      d -= c;
    }
    gcd = c;
    lcm = (a/gcd) * b;
    cout << gcd << " " << lcm << endl;
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int a,int b){
    while(a>0&&b>0){
        if(a>b)
            a%=b;
        else
            b%=a;
    }
    if(a==0)
        return b;
    else if(b==0)
        return a;
}
int main(){
    int a,b;
    while(cin>>a>>b){
        int c=gcd(a,b);
        int lcm=a*b/c;
        cout<<c<<" "<<lcm<<endl;
    }
    return 0;
}