Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

func lcm(x, y int64) int64 {
	return x / gcd(x, y) * y
}

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

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<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<iostream>
using namespace std;

int main()
{
	int a, b;
	int c, d;
	int i = 2;
	int j = 2;
	
	while(1)
	{
		cin >> a >> b;
		c = a;
		d = b;
		
		while(c != d){
			if(c < d){
				c = a * i;
				i++;
			}else if(c > d){
				d = b * j;
				j++;
			}
		}
		
		/**********************************/
		
		int e, f;
		int k = 2;
		int l = 2;
		e = a;
		f = b;
		
		while(e != f){
			if(e > f){
				e = a / k;
				k++;
			}else if(e < f){
				f = b / l;
				l++;
			}
		}
		
		
		cout << e << " " << c << endl;
	}
	
	return 0;
}

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

#define MAX 256

int main(void){
	
	int max[50], min[50];
	for (int i = 0; i < 50; i++){
		max[i] = 0;
		min[i] = 0;
	}

	int a, b;
	int i = 0;

	while (scanf("%d%d", a, b) != EOF){
		while (max[i] == 0){
			for (int j = 0; j > 0; j--){
				if (a%j == 0 && b%j == 0)max[i] = j;
			}
		}
		int j = 1;
		while (min[i] == 0){
			if ((a*j) % b == 0)min[i] = a*j;
			j++;
		}
		i++;
	}

	for (int j = 0; j < i; j++){
		printf("%d %d\n", max[j], min[j]);
	}

	return 0;
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	int a[2];
	int tmp;
	int GCD = 1;
	int LCM = 1;
	while (cin >> a[0] >> a[1])
	{
		// ????????????????????????
		if (a[0] < a[1]) {
			tmp = a[0];
			a[0] = a[1];
			a[1] = tmp;
		}
		else {}
		// ?????§??¬?´???°????¨????
		for (size_t i = 1; i < a[0]; i++)
		{
			if (a[0] % i == 0 && a[1] % i == 0)
			{
				GCD = i;
			}
		}

		// ????°???¬?????°????¨????
		for (size_t i = a[0];; i++)
		{
			if (i % a[0] == 0 && i % a[1] == 0) {
				LCM = i;
				break;
			}
		}
		// ??????
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

C++: #import<bits/stdc++.h>
using namespace std;int a,b;main(){while(~scanf("%d%d",&a,&b))printf("%d %d\n",__gcd(a,b),a/__gcd(a,b)*b);}

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

int gcd(int a, int b){
	return (b>0)? gcd(b, a%b) : a;
}
int lcm(int a, int b){
	return a / gcd(a, b) * b;
}

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

C++: #include <iostream>

using namespace std;

int gcd(int a, int b)
{
	return (b > 0)? gcd(b , a % b) : 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;
	}

	
	return 0;
}

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+bb/a);
	}
}

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, tmp;
    if (a < b){
        tmp = b;
b = a;
a = tmp;

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

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

int main(void){
     long int n,m;
     long int c,e;
     long int l;
     cin >> n >> m;
     c = n;
     e = m;
     while(1){
	  if(c==e){
	       break;
	  }else if(c>e){
	       c = c-e;
	  }else if(c<e){
	       e = e-c;
	  }
     }
     l = (n*m)/c;
     cout << c << " " << l << endl;
     return 0;
}

C++: #include <iostream>
#include <algorithm>
#define llong long long
llong gcd(llong a, llong b)
{
    llong mod;
    mod = std::max(a, b) % std::min(a, b);
    if(mod == 0) return std::min(a, b);
    else return gcd(std::min(a, b), mod);
}
llong lcm(llong a, llong b, llong gcd)
{
    return (a * b) / gcd;
}
int main()
{
    llong a, b;
    while(std::cin >> a >> b)
    {
        llong g = gcd(a, b);
        std::cout << g << " " << lcm(a, b, g) << std::endl;
    }
}

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

int main(){
	int a, b, gcd, lcm, x, y, r;
	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r = x % y){
			x = y;
			y = r;
		}
		gcd = y;
		lcm = a * b / gcd;

		cout << gcd << " " << lcm << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int lcm(int a,int b);
int main(){
	for(;;){
		int a,b;
		if(scanf("%d %d",&a,&b) == EOF){break;}
		int x = lcm(a,b);
		int y = a/x*b;
		cout <<x<<" "<<y<<endl;
	}
	return 0;
}
int lcm(int a,int b){
	if (a == 0){return b;}
	return lcm(b%a,a);
}

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

using namespace std;

int gcm(int a, int b){
	
	if(b > a){
	int d;
	d = a;
	a = b;
	b = d;
	}	
	
	int c;
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	
	}
	return a;
}

int main(){
	long long c,d,e;
	std::cin>>c>>d;

	e = gcm(c,d);

	std::cout<<e<<" "<<(c*d)/e;
}

C++: #include<iostream>
using namespace std;
int main(){
  int sn,bn;
  int p,lcm,gcd;
  while(cin>>sn>>bn){
  p = bn * sn;
  for(int i=bn;i<=p;i++){
    if(i%sn==0&&i%bn==0){
      lcm = i;
      break;
    }
  }
  for(int i=sn;i>=1;i--){
    if(sn%i==0&&bn%i==0){
      gcd = i;
      break;
    }
  }
  cout << gcd << ' '<< lcm <<endl;
  }
  return 0;
}

C++: #include<cstdio>

int gcd(int a, int b){
    if(a == b)
        return a;
    else if(a > b)
        a -= b;
    else if(a < b)
        b -= a;
    return gcd(a, b);
}

int lcm(int a, int b){

    return (a / gcd(a, b)) * (b / gcd(a, b)) * gcd(a, b);
}

int main(){
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d %d\n", gcd(a, b), lcm(a, b));
    return 0;
}