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\n", G, L)
	}
}

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

int Euc(int a, int b){
	int c;
	while(a % b != 0){
		c = b;
		b = a % b;
		a = c;
	}
	
	return b;
}

int main(){
	int a, b;
	int gcd, lcm;
	int sub;
	
	while((scanf("%d", &a)) != EOF){
		scanf("%d", &b);
		
		if(a < b){
			sub = a;
			a = b;
			b = sub;
		}
		
		gcd = Euc(a, b);
		lcm = (a / gcd) * b;
		
		printf("%d %d\n", gcd, lcm);
	}
	
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int a[2];
int main(){
	while(cin>>a[0]>>a[1]){
		sort(a,a+2);
		for(int i=a[0];;i--){
			if(a[0]%i==0&&a[1]%i==0){
				cout<<i<<" "<<(long long)a[0]*a[1]/i<<endl;
				goto loop;
			}
		}
		loop:;
		age:;
	}
	return 0;
}

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

int main(){
  int a, b;
  while(scanf("%d %d", &a, &b) != EOF){
    int gcd=1;
    int n = 2;
    while(a!=1 && b!=1){
      if(a%n==0 && b%n==0){
	a = a/n;
	b = b/n; 
	gcd = gcd * n;
      }
      else{
	if(n > a)
	  break;
	else
	  n++;}
    }
    printf("%d %d\n", gcd, a*b*gcd);
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>

#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF 1<<30
#define ALEN(ARR) (sizeof(ARR) / sizeof(ARR[0]))
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define ll long long
#define ull unsigned long long
#define MOD 1000000007

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(16);

  ll a, b;
  while(cin >> a >> b) cout << __gcd(a, b) << " " << (a * b) / __gcd(a, b) << endl;

  return 0;
}

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

int main(){
	long a,b,c,ab;
	while(cin >> a >> b){
		ab=a*b;
		while(b!=0){
			a=a%b;
			c=b;b=a;a=c;
		}
		cout << a <<" " <<ab/a<<"\n";
	}
return 0;
}

C++: int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	for(int i=0;i<5;i++){
		int a,b;
		std::cin>>a>>b;
		std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl;
		
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <stdint.h>
using namespace std;

template <class T>
T gcd(const T &a, const T &b)
{
  if (b == 0) return a;
  return gcd(b, a % b);
}

template <class T>
T lcm(const T &a, const T &b)
{
  T g = gcd(a, b);
  return a / g * b;
}

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

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

int main(){
   int a, b, tmp, m=0, s=0, ai, bi;
   while(cin >> a >> b){
      ai=a; bi=b;
      while(1){
         if(a<b){
            tmp=a;
            a=b;
            b=tmp;
         }
         if(a%b==0){
            m=b;
            break;
         }else a=a%b;
         
      }
      s=ai*bi/m;
      cout<< m << " " << s << endl;
   }
   return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,g,x,y,L,i=0;
while(cin>>a>>b){
x=a;y=b;
while(1){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
  else if(x==y){g=x;break;}
}
L=(a*b)/g;
cout<<g<<" "<<L<<endl;
x=0;y=0;
  ++i;
  if(i==49){break;}
}
  return 0;
}

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

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

int main(){
    int a, b, GCD;
    while(std::cin >> a >> b){
        if(a < b)
            std::swap(a, b);
        GCD = getGCD(a, b);
        std::cout << GCD << " " << (a/GCD) * b <<std::endl;
    }
}

C++: #include <iostream> 
#include<string.h>
#include<stdio.h>
using namespace std;
long long cc( long  long  q, long long  p)
{

	if(q%p==0)
	{
		return p;
	}
	else
	return cc(p,q%p);
}
main()
{
	long long x,y,a[1000],b[1000];
	int i=0;
	while(scanf("%lld%lld",&x,&y)!=EOF)
	{
	  
		 a[i]=cc(x,y);
		 b[i]=x*y/a[i];
	     i++;	
	     
	    
	}
	for(int j=0;j<i;j++)
	{
		printf("%lld %lld\n",a[i],b[i]);
	}
}

C++: 
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <set>
#include <map>
#define INF 100000
using namespace std;
typedef long long int ll;

ll gcd(ll n, ll m){
    if (n>=m) {
        if(n%m>0){
            return gcd(m,n%m);
        }else{
            return m;
        }
    }else{
        return gcd(m,n);
    }
}

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

C++: #include <iostream>

using namespace std;

int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i>j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	
	if(j == 0){
		return i;
	}else{
		return gcd(j, i%j);
	}
	
}

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

C++: // B.cpp

#include <iostream>
#include <cmath>

using namespace std;

int gcd(int, int);
int lcm(int, int);

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

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a < b){
		max = b, min = a;
	}
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

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

int gcd(int u, int v)
{
  int r, z;

    if(v > u)
    {
      z = u;
      u = v;
      v = z;
    }

  while((r = u%v) != 0)
  {
    u = v;
    v = r;
  }    
  return v;  
}


int main(void)
{
  int a, b;

  while(scanf("%d %d", &a, &b))
  {      
    printf("%d %d\n", gcd(a,b), b/gcd(a,b)*a);
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
    int n, m, a, b, i, j, g;
    
    while(cin >> n >> m){
        a=n;b=m;i=2;j=2;
        while(a!=b){
            if(a<b) a=n*i++;
            else b=m*j++;
        }
        g = n*((float)m/a);
        cout << g << " " << a << endl;
    }
    return 0;
}

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

long int mygcd(long int a, long int b)
{
    if (b == 0) return a;
    if (a < b) return mygcd(b,a);
    return mygcd(a-b,b);
}

int main(void)
{
    long int a,b;

    while(cin >> a)
    {
        cin >> b;
        long int gcd = mygcd(a,b);
        long int lcm = a*b/gcd;

        cout << gcd << " " << lcm << 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;
}